public boolean isNameValid(String name) {
        return name != null && name.length() <= MAX_LENGTH && XmlUtils.matchUsingRegex(NAME_TYPE_PATTERN_REGEX, name);
    }
@Test
    public void shouldValidateNameBasedOnCharacterType() {
        //[a-zA-Z0-9_\-]{1}[a-zA-Z0-9_\-.]*
        assertThat(new NameTypeValidator().isNameValid(""), is(false));
        assertThat(new NameTypeValidator().isNameValid("name"), is(true));

        assertThat(new NameTypeValidator().isNameValid("!"), is(false));
        assertThat(new NameTypeValidator().isNameValid("name!"), is(false));

        assertThat(new NameTypeValidator().isNameValid("name_123"), is(true));
        assertThat(new NameTypeValidator().isNameValid("1"), is(true));

        assertThat(new NameTypeValidator().isNameValid("."), is(false));
        assertThat(new NameTypeValidator().isNameValid("1."), is(true));
    }