diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-03-02 14:32:01 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-03-02 14:35:52 +0100 |
commit | 0ac19e55b447e9bc966282e1ba9cae9f23ae4f91 (patch) | |
tree | 4aaab6159bb0ace904af76f3d797aec6b273cd6f /directory/src/test | |
parent | 5fb1fa01e75b2d47aad321f00fb28ea2c4478a8f (diff) |
Rename Discovery* => Directory*.
Diffstat (limited to 'directory/src/test')
-rw-r--r-- | directory/src/test/java/com/orbekk/same/discovery/NetworkEntryTest.java | 27 |
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)); + } +} |