UriPatternOrderedMatcher implements LookupRegistry<T> { public synchronized Set<Entry<String, T>> entrySet() { return new HashSet<>(map.entrySet()); } UriPatternOrderedMatcher(); synchronized Set<Entry<String, T>> entrySet(); @Override synchronized void register(final String pattern, final T obj); @Override synchronized void unregister(final String pattern); @Override synchronized T lookup(final String path); @Override String toString();  }
@Test public void testEntrySet() throws Exception { final Object h1 = new Object(); final Object h2 = new Object(); final Object h3 = new Object(); final UriPatternOrderedMatcher<Object> matcher = new UriPatternOrderedMatcher<>(); Assert.assertEquals(0, matcher.entrySet().size()); matcher.register("/h1", h1); Assert.assertEquals(1, matcher.entrySet().size()); matcher.register("/h2", h2); Assert.assertEquals(2, matcher.entrySet().size()); matcher.register("/h3", h3); Assert.assertEquals(3, matcher.entrySet().size()); }