summaryrefslogtreecommitdiff
path: root/directory/src/test
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-03-02 14:32:01 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-03-02 14:35:52 +0100
commit0ac19e55b447e9bc966282e1ba9cae9f23ae4f91 (patch)
tree4aaab6159bb0ace904af76f3d797aec6b273cd6f /directory/src/test
parent5fb1fa01e75b2d47aad321f00fb28ea2c4478a8f (diff)
Rename Discovery* => Directory*.
Diffstat (limited to 'directory/src/test')
-rw-r--r--directory/src/test/java/com/orbekk/same/discovery/NetworkEntryTest.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/directory/src/test/java/com/orbekk/same/discovery/NetworkEntryTest.java b/directory/src/test/java/com/orbekk/same/discovery/NetworkEntryTest.java
new file mode 100644
index 0000000..455de90
--- /dev/null
+++ b/directory/src/test/java/com/orbekk/same/discovery/NetworkEntryTest.java
@@ -0,0 +1,27 @@
+package com.orbekk.same.discovery;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.orbekk.same.directory.NetworkEntry;
+
+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));
+ }
+}