@Test public void testInvalidPackageNames() { for (String illegal : new String[] {".", "foo-bar", "foo_bar", "1a", "a.foo"}) { assertThatThrownBy(() -> PackageValidator.validate(illegal)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Conjure package names must match pattern ^([a-z][a-z0-9]+(\\.[a-z][a-z0-9]*)*)?$: " + illegal); } }
public static void validate(String name) { Preconditions.checkArgument( VALID_PACKAGE.matcher(name).matches(), "Conjure package names must match pattern %s: %s", VALID_PACKAGE.pattern(), name); }
PackageValidator { public static void validate(String name) { Preconditions.checkArgument( VALID_PACKAGE.matcher(name).matches(), "Conjure package names must match pattern %s: %s", VALID_PACKAGE.pattern(), name); } }
PackageValidator { public static void validate(String name) { Preconditions.checkArgument( VALID_PACKAGE.matcher(name).matches(), "Conjure package names must match pattern %s: %s", VALID_PACKAGE.pattern(), name); } private  PackageValidator(); }
PackageValidator { public static void validate(String name) { Preconditions.checkArgument( VALID_PACKAGE.matcher(name).matches(), "Conjure package names must match pattern %s: %s", VALID_PACKAGE.pattern(), name); } private  PackageValidator(); static List<String> components(String name); static void validate(String name); static String conjurePackage(Iterable<String> components); }
PackageValidator { public static void validate(String name) { Preconditions.checkArgument( VALID_PACKAGE.matcher(name).matches(), "Conjure package names must match pattern %s: %s", VALID_PACKAGE.pattern(), name); } private  PackageValidator(); static List<String> components(String name); static void validate(String name); static String conjurePackage(Iterable<String> components); static final String PRIMITIVE; }