public boolean isNameValid(String name) {
        return name != null && name.length() <= MAX_LENGTH && XmlUtils.matchUsingRegex(NAME_TYPE_PATTERN_REGEX, name);
    }
@Test
    public void shouldValidateNameBasedOnLength() {
        assertThat(new NameTypeValidator().isNameValid("name"), is(true));
        assertThat(new NameTypeValidator().isNameValid(nameOfLength(255)), is(true));
        assertThat(new NameTypeValidator().isNameValid(nameOfLength(256)), is(false));
    }