InputValidator { public static boolean isValidClusterNamespace(String input) { Matcher matcher = CLUSTER_NAMESPACE_PATTERN.matcher(input); return matcher.matches(); }  static boolean isValidClusterNamespace(String input); static boolean isValidAppNamespace(String name); static final String INVALID_CLUSTER_NAMESPACE_MESSAGE; static final String INVALID_NAMESPACE_NAMESPACE_MESSAGE; static final String CLUSTER_NAMESPACE_VALIDATOR; static final String APP_NAMESPACE_VALIDATOR; }
@Test public void testIsValidClusterNamespaceWithCorrectInput() throws Exception { String someValidInput = "a1-b2_c3.d4"; assertTrue(InputValidator.isValidClusterNamespace(someValidInput)); }
@Test public void testIsValidClusterNamespaceWithInCorrectInput() throws Exception { String someInvalidInput = "中文123"; assertFalse(InputValidator.isValidClusterNamespace(someInvalidInput)); String anotherInvalidInput = "123@#{}"; assertFalse(InputValidator.isValidClusterNamespace(anotherInvalidInput)); }