Strings { public static boolean isWhitelisted(String item, List<String> whitelist) { if (isEmptyOrNull(whitelist) || isEmptyOrWhitespace(item)) { return false; } return whitelist.contains(item); }  static boolean isEmptyOrWhitespace(String string); static boolean isEmptyOrNull(List<String> list); static boolean isWhitelisted(String item, List<String> whitelist); static String stripLeadingSlash(String s); static String stripTrailingSlash(String s); static String stripSlash(String s);  }
@Test public void testIsWhitelisted() { assertFalse(Strings.isWhitelisted(null, ImmutableList.<String>of(""))); assertFalse(Strings.isWhitelisted(" ", ImmutableList.<String>of(" "))); assertFalse(Strings.isWhitelisted("abc", null)); assertFalse(Strings.isWhitelisted("abc", ImmutableList.<String>of())); assertTrue(Strings.isWhitelisted("abc", ImmutableList.<String>of("abc", "def"))); assertFalse(Strings.isWhitelisted("abc", ImmutableList.<String>of("def"))); }