CodeSourceCollapser implements StringCollapser { private CodeSourceCollapser() { } private  CodeSourceCollapser(); static CodeSourceCollapser getInstance(); @Override Map<String, Collection<T>> collapse(Map<String, Collection<T>> input); static boolean pathMatches(String matcher, String matchee);  }
@Test public void testCodeSourceCollapser() { final CodeSourceCollapser collapser = CodeSourceCollapser.getInstance(); Map<String, Collection<Void>> output = collapser.collapse(nullMap( "/home/tomcat/webapps/myapp/WEB-INF/classes/com/foo/Foo.class", "/home/tomcat/webapps/myapp/WEB-INF/classes/com/bar/Bar.class", "/home/tomcat/webapps/myapp/WEB-INF/lib/foo.jar", "/home/tomcat/webapps/myapp/WEB-INF/lib/bar.jar" )); assertEquals(output.size(), 2); assertTrue(output.containsKey("/home/tomcat/webapps/myapp/WEB-INF/classes/-")); assertTrue(output.containsKey("/home/tomcat/webapps/myapp/WEB-INF/lib/-")); }