PackageNameMatcher { public static PackageNameMatcher compile(final List<String> specs) { if (specs == null) { throw new IllegalArgumentException("null package name specifications"); } final List<Pattern> list = new ArrayList<>(); for (String part : specs) { list.add(buildPattern(part)); } return new PackageNameMatcher(list); } private  PackageNameMatcher(List<Pattern> patterns); static PackageNameMatcher compile(final List<String> specs); boolean matches(String packageName); @Override String toString();  }
@Test public void testNoPattern() { assertNotNull(PackageNameMatcher.compile(new ArrayList<String>())); }
@Test public void testPattern06() { assertThrows(IllegalArgumentException.class, () -> PackageNameMatcher.compile(asList("com.example.!"))); }
@Test public void testPattern07() { final List<String> specs = List.of("com.example.*", "org.example.!"); assertThrows(IllegalArgumentException.class, () -> PackageNameMatcher.compile(specs)); }
@Test public void testSpacesPattern01() { assertThrows(IllegalArgumentException.class, () -> PackageNameMatcher.compile(asList(" "))); }
@Test public void testSpacesPattern02() { assertThrows(IllegalArgumentException.class, () -> PackageNameMatcher.compile(asList("\t\t"))); }
@Test(expected = IllegalArgumentException.class) public void testPattern06() { PackageNameMatcher.compile(asList("com.example.!")); }
@Test(expected = IllegalArgumentException.class) public void testPattern07() { final List<String> specs = new ArrayList<>(); specs.add("com.example.*"); specs.add("org.example.!"); PackageNameMatcher.compile(specs); }
@Test(expected = IllegalArgumentException.class) public void testSpacesPattern01() { PackageNameMatcher.compile(asList(" ")); }
@Test(expected = IllegalArgumentException.class) public void testSpacesPattern02() { PackageNameMatcher.compile(asList("\t\t")); }