Skip to content

Instantly share code, notes, and snippets.

@tfnico
Created September 7, 2012 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfnico/3667190 to your computer and use it in GitHub Desktop.
Save tfnico/3667190 to your computer and use it in GitHub Desktop.
Some guava tests
@Test
public void validName() {
String name = "Thomas";
assertTrue(findInvalidChars(name, WhitelistCharacters.VALID_NAME_CHAR_SET).isEmpty());
}
@Test
public void invalidName() {
assertThat(findInvalidChars("<Thomas>", VALID_NAME_CHAR_SET), hasItems('<', '>'));
}
@Test
public void prettyListOfInvalidChars() {
String name = "<Th0mas>";
assertEquals("<, 0, >", WhitelistCharacters.printChars(findInvalidChars(name, VALID_NAME_CHAR_SET)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment