summaryrefslogtreecommitdiff
path: root/discovery/src/test/java/com
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-03-02 13:58:09 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-03-02 13:58:09 +0100
commit4a4dc574fcb44f5d92b488de1efeba40d1e6469f (patch)
treeccbd3fdccbf5bbf22c696d8f35231bf55df4f711 /discovery/src/test/java/com
parent6572275c069699c753c906078580d7c507e120c6 (diff)
Begin implementing discovery service.
Diffstat (limited to 'discovery/src/test/java/com')
-rw-r--r--discovery/src/test/java/com/orbekk/same/discovery/NetworkEntryTest.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/discovery/src/test/java/com/orbekk/same/discovery/NetworkEntryTest.java b/discovery/src/test/java/com/orbekk/same/discovery/NetworkEntryTest.java
new file mode 100644
index 0000000..dacaf9c
--- /dev/null
+++ b/discovery/src/test/java/com/orbekk/same/discovery/NetworkEntryTest.java
@@ -0,0 +1,25 @@
+package com.orbekk.same.discovery;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class NetworkEntryTest {
+ @Test
+ public void testExpiry() {
+ NetworkEntry entry = new NetworkEntry("NetworkA", "UrlA");
+ entry.register(100);
+ assertFalse(entry.hasExpired(50));
+ assertTrue(entry.hasExpired(101));
+ }
+
+ @Test
+ public void testRegister() {
+ NetworkEntry entry = new NetworkEntry("NetworkB", "UrlB");
+ long time = 1000000000000l;
+ entry.register(time);
+ assertTrue(entry.hasExpired(time+1));
+ entry.register(time + 1000);
+ assertFalse(entry.hasExpired(time + 500));
+ }
+}