### Question:
Labels { public static boolean isValid(String name) { return name.matches(VALID_VALUE_REGEX) && name.length() <= MAXIMUM_NAME_LENGTH; } private  Labels(); static String sanitize(String name); static boolean isValid(String name); static String validate(String name);  }### Answer:
@Test public void testValid() { assertThat(Labels.isValid("abcdefghijklmnopqrstyvwxyz0123456789")).isTrue(); assertThat(Labels.isValid("012345678901234567890123456789012345678901234567890123456789123")).isTrue(); }
@Test public void testInvalid() { assertThat(Labels.isValid("-abcdefghijklmnopqrstyvwxyz0123456789")).isFalse(); assertThat(Labels.isValid("abcdefghijklmnopqrstyvwxyz0123456789-")).isFalse(); assertThat(Labels.isValid("01234567890123456789012345678901234567890123456789012345678912345")).isFalse(); }
@Test public void testValidateGeneratedKeys() { for (int i = 0; i < 1000; i++) { assertThat(Labels.isValid(KeyGenerator.createKey())).isTrue(); } }