TreeDispatcher implements Dispatcher<E> { @Override public E findExactMatch(String path) { return tree.get(delimiter.split(path)); }  void setDelimiter(String delimiter); @Override void addEndpoint(String path, E endpoint); @Override E removeEndpoint(String path); @Override E findExactMatch(String path); @Override List<E> findPrefixMatches(String path);  }
@Test public void testFindExactMatch() { TreeDispatcher<String> dispatcher = setupDispatcher(); assertNull(dispatcher.findExactMatch("")); assertNull(dispatcher.findExactMatch("/")); assertNull(dispatcher.findExactMatch("/one")); assertEquals(dispatcher.findExactMatch("/one/two"), "/one/two"); assertNull(dispatcher.findExactMatch("/one/two/three")); assertEquals(dispatcher.findExactMatch("/one/two/three/four"), "/one/two/three/four"); assertNull(dispatcher.findExactMatch("/one/two/three/four/five")); assertEquals(dispatcher.findExactMatch("/one/two/three/four/five/six"), "/one/two/three/four/five/six"); assertNull(dispatcher.findExactMatch("/one/two/three/four/five/six/seven")); assertNull(dispatcher.findExactMatch("/one/three")); assertNull(dispatcher.findExactMatch("/one/three/three")); assertEquals(dispatcher.findExactMatch("/one/three/three/four"), "/one/three/three/four"); assertNull(dispatcher.findExactMatch("/one/three/three/four/five")); assertEquals(dispatcher.findExactMatch("/one/three/three/four/five/six"), "/one/three/three/four/five/six"); assertNull(dispatcher.findExactMatch("/one/three/three/four/five/six/seven")); assertNull(dispatcher.findExactMatch("/one/three/four")); assertNull(dispatcher.findExactMatch("/one/four")); assertEquals(dispatcher.findExactMatch("/one assertEquals(dispatcher.findExactMatch(" assertEquals(dispatcher.findExactMatch(" assertNull(dispatcher.findExactMatch("/*")); assertNull(dispatcher.findExactMatch("/.*")); assertNull(dispatcher.findExactMatch("one")); assertNull(dispatcher.findExactMatch("/one/tw")); assertNull(dispatcher.findExactMatch("/one/twoo")); assertNull(dispatcher.findExactMatch("/one/two*")); assertNull(dispatcher.findExactMatch("/one/two.*")); assertNull(dispatcher.findExactMatch("/on/two")); assertNull(dispatcher.findExactMatch("/onee/two")); assertNull(dispatcher.findExactMatch("/onetwo")); assertNull(dispatcher.findExactMatch("/oneetwo")); assertNull(dispatcher.findExactMatch("/one\\two")); }