LocationMatcher implements Comparable<LocationMatcher> { public boolean matchesPackage(String packageName) { return matchesPattern(loc.pack, packageName) && matchesAll(loc.clazz) && matchesAll(loc.method); } LocationMatcher(Location location); boolean matchesPackage(String packageName); boolean matchesClass(String className); boolean matchesPackageClass(String packageName, String className); boolean matches(String packageName, String className, String methodName); boolean matchesLanguage(Language language); int specificity(); String getPattern(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override int compareTo(LocationMatcher p);  }
@Test void startStar() { final LocationMatcher m = new LocationMatcher(Location.of("*pa")); assertTrue(m.matchesPackage("pa")); assertTrue(m.matchesPackage("xxxpa")); assertFalse(m.matchesPackage("paxxx")); }
@Test void startPlus() { final LocationMatcher m = new LocationMatcher(Location.of("+pa")); assertFalse(m.matchesPackage("pa")); assertTrue(m.matchesPackage("xxxpa")); assertFalse(m.matchesPackage("paxxx")); }
@Test void endStar() { final LocationMatcher m = new LocationMatcher(Location.of("pa*")); assertTrue(m.matchesPackage("pa")); assertFalse(m.matchesPackage("xxxpa")); assertTrue(m.matchesPackage("paxxx")); }
@Test void endDotStar() { final LocationMatcher m = new LocationMatcher(Location.of("pa.*")); assertTrue(m.matchesPackage("pa")); assertFalse(m.matchesPackage("paxxx")); assertTrue(m.matchesPackage("pa.xxx")); }
@Test void endPlus() { final LocationMatcher m = new LocationMatcher(Location.of("pa+")); assertFalse(m.matchesPackage("pa")); assertFalse(m.matchesPackage("xxxpa")); assertTrue(m.matchesPackage("paxxx")); }
@Test void bothWildcard() { final LocationMatcher m = new LocationMatcher(Location.of("*pa*")); assertTrue(m.matchesPackage("pa")); assertTrue(m.matchesPackage("xxxpa")); assertTrue(m.matchesPackage("paxxx")); assertFalse(m.matchesPackage("")); }
@Test void onlyWildcard() { final LocationMatcher m = new LocationMatcher(Location.of("*")); assertTrue(m.matchesPackage("pa")); assertTrue(m.matchesPackage("")); }