NameValidationUtils { private static boolean isValid(String name, String regex) { return Pattern.matches(regex, name); }  static boolean isValid(String name); static void validate(String ownerKey, String name); static void validateApplicationName(String name); static void validateApplicationId(String id); static void validateNodeName(String name); static final String DEFAULT_NAME_REGEX; static final Pattern DEFAULT_NAME_REPLACE_PATTERN; static final String APPLICATION_NAME_REGEX; static final String NODE_NAME_REGEX; }
@Test public void isValidTest() { Assert.assertTrue(NameValidationUtils.isValid("Compute")); Assert.assertTrue(NameValidationUtils.isValid("Compute_2")); Assert.assertFalse(NameValidationUtils.isValid("Computé")); Assert.assertFalse(NameValidationUtils.isValid("Compute-2")); Assert.assertFalse(NameValidationUtils.isValid("Compute.unix")); Assert.assertFalse(NameValidationUtils.isValid("Compute 2")); }