@Test public void checkLowerSnakeCaseShouldThrowIllegalArgumentExceptionWithFieldForInvalidString() { exception.expect(IllegalArgumentException.class); exception.expectMessage( Strings.lenientFormat( "invalid value for %s resource, %s: %s", "feature", "Invalid_feature name", "argument must be in lower snake case, and cannot include any special characters.")); String in = "Invalid_feature name"; checkLowerSnakeCase(in, "feature"); }
public static void checkLowerSnakeCase(String input, String resource) throws IllegalArgumentException { if (!LOWER_SNAKE_CASE_REGEX.matcher(input).matches()) { throw new IllegalArgumentException( String.format( ERROR_MESSAGE_TEMPLATE, resource, input, "argument must be in lower snake case, and cannot include any special characters.")); } }
Matchers { public static void checkLowerSnakeCase(String input, String resource) throws IllegalArgumentException { if (!LOWER_SNAKE_CASE_REGEX.matcher(input).matches()) { throw new IllegalArgumentException( String.format( ERROR_MESSAGE_TEMPLATE, resource, input, "argument must be in lower snake case, and cannot include any special characters.")); } } }
Matchers { public static void checkLowerSnakeCase(String input, String resource) throws IllegalArgumentException { if (!LOWER_SNAKE_CASE_REGEX.matcher(input).matches()) { throw new IllegalArgumentException( String.format( ERROR_MESSAGE_TEMPLATE, resource, input, "argument must be in lower snake case, and cannot include any special characters.")); } }  }
Matchers { public static void checkLowerSnakeCase(String input, String resource) throws IllegalArgumentException { if (!LOWER_SNAKE_CASE_REGEX.matcher(input).matches()) { throw new IllegalArgumentException( String.format( ERROR_MESSAGE_TEMPLATE, resource, input, "argument must be in lower snake case, and cannot include any special characters.")); } }  static void checkUpperSnakeCase(String input, String resource); static void checkLowerSnakeCase(String input, String resource); static void checkValidCharacters(String input, String resource); static void checkValidCharactersAllowAsterisk(String input, String resource); static void checkValidBigQueryTableRef(String input, String resource); static boolean hasDuplicates(Collection<String> strings); }
Matchers { public static void checkLowerSnakeCase(String input, String resource) throws IllegalArgumentException { if (!LOWER_SNAKE_CASE_REGEX.matcher(input).matches()) { throw new IllegalArgumentException( String.format( ERROR_MESSAGE_TEMPLATE, resource, input, "argument must be in lower snake case, and cannot include any special characters.")); } }  static void checkUpperSnakeCase(String input, String resource); static void checkLowerSnakeCase(String input, String resource); static void checkValidCharacters(String input, String resource); static void checkValidCharactersAllowAsterisk(String input, String resource); static void checkValidBigQueryTableRef(String input, String resource); static boolean hasDuplicates(Collection<String> strings);  }