XmlCharacters { public static boolean isValidNameStart(int c) { return c < NUMBER_OF_CHARACTERS && (MASKS[c] & NAME_START_CHARACTER) != 0; } private  XmlCharacters(); static boolean isValidNameStart(int c); static boolean isValidNcNameStart(int c); static boolean isValidName(int c); static boolean isValidNcName(int c); static boolean isValidPubid(int c); static boolean isValid(int c); static boolean isValidContent(int c); static boolean isValidSpace(int c); static boolean isValidName(String name); static boolean isValidNcName(String name);  }
@Test public void shouldNotAllowDigitAsFirstCharacterInName() { assertThat(XmlCharacters.isValidNameStart('0')).isFalse(); assertThat(XmlCharacters.isValidNameStart('1')).isFalse(); assertThat(XmlCharacters.isValidNameStart('2')).isFalse(); assertThat(XmlCharacters.isValidNameStart('3')).isFalse(); assertThat(XmlCharacters.isValidNameStart('4')).isFalse(); assertThat(XmlCharacters.isValidNameStart('5')).isFalse(); assertThat(XmlCharacters.isValidNameStart('6')).isFalse(); assertThat(XmlCharacters.isValidNameStart('7')).isFalse(); assertThat(XmlCharacters.isValidNameStart('8')).isFalse(); assertThat(XmlCharacters.isValidNameStart('9')).isFalse(); }
@Test public void shouldAllowLettersAsFirstCharacterInName() { for (char c = 'a'; c <= 'z'; ++c) { assertThat(XmlCharacters.isValidNameStart(c)).isTrue(); } for (char c = 'A'; c <= 'Z'; ++c) { assertThat(XmlCharacters.isValidNameStart(c)).isTrue(); } }