Matchers { public static void checkUpperSnakeCase(String input, String resource) throws IllegalArgumentException { if (!UPPER_SNAKE_CASE_REGEX.matcher(input).matches()) { throw new IllegalArgumentException( String.format( ERROR_MESSAGE_TEMPLATE, resource, input, "argument must be in upper 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 checkUpperSnakeCaseShouldPassForLegitUpperSnakeCase() { String in = "REDIS_DB"; checkUpperSnakeCase(in, "featureset"); }
@Test public void checkUpperSnakeCaseShouldPassForLegitUpperSnakeCaseWithNumbers() { String in = "REDIS1"; checkUpperSnakeCase(in, "featureset"); }
@Test public void checkUpperSnakeCaseShouldThrowIllegalArgumentExceptionWithFieldForInvalidString() { exception.expect(IllegalArgumentException.class); exception.expectMessage( Strings.lenientFormat( "invalid value for %s resource, %s: %s", "featureset", "redis", "argument must be in upper snake case, and cannot include any special characters.")); String in = "redis"; checkUpperSnakeCase(in, "featureset"); }