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);  }
@Test public void checkLowerSnakeCaseShouldPassForLegitLowerSnakeCase() { String in = "feature_name_v1"; checkLowerSnakeCase(in, "feature"); }
@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"); }