@Test public void lookupUnbound() throws Exception { registry.bind(KEY, VALUE); registry.unbind(KEY); final String result = registry.lookup(KEY); assertNull("Expectected value not to be bound", result); }
@Test public void listAllBound() throws Exception { registry.bind(KEY, VALUE); registry.bind("anotherkey", "anothervalue"); final Set<String> expected = new HashSet<String>(Arrays.asList(KEY, "anotherkey")); final Set<String> result = registry.listBound(); assertEquals("Unexpected bound list", expected, result); }
@Test(expectedExceptions = AlreadyBoundException.class) public void doNotBoundTwice() throws Exception { registry.bind(KEY, VALUE); registry.bind(KEY, "another value 123!@#"); }
@Test public void lookupNotBound() { final String result = registry.lookup(KEY); assertNull("Expectected value not to be bound", result); }
@Test public void lookupBound() throws Exception { registry.bind(KEY, VALUE); final String result = registry.lookup(KEY); assertSame("Unexpected value found", VALUE, result); }