### Question:
BasicGadgetBlacklist implements GadgetBlacklist { public boolean isBlacklisted(Uri gadgetUri) { String uriString = gadgetUri.toString().toLowerCase(); if (exactMatches.contains(uriString)) { return true; } for (Pattern pattern : regexpMatches) { if (pattern.matcher(uriString).matches()) { return true; } } return false; } BasicGadgetBlacklist(File blacklistFile); @Inject  BasicGadgetBlacklist(@Named("shindig.blacklist.file") String file); boolean isBlacklisted(Uri gadgetUri);  }### Answer:
@Test public void testEmptyBlacklist() throws Exception { GadgetBlacklist bl = createBlacklist(""); assertFalse(bl.isBlacklisted(someUri)); }
@Test public void testExactMatches() throws Exception { GadgetBlacklist bl = createBlacklist(someUri + "\nhttp: assertFalse(bl.isBlacklisted(Uri.parse("http: assertTrue(bl.isBlacklisted(someUri)); }
@Test public void testExactMatchesWithCaseMixture() throws Exception { GadgetBlacklist bl = createBlacklist(someUri + "\nhttp: assertTrue(bl.isBlacklisted(someUri)); assertTrue(bl.isBlacklisted(Uri.parse("http: assertTrue(bl.isBlacklisted(Uri.parse("http: }
@Test public void testIgnoredCommentsAndWhitespace() throws Exception { GadgetBlacklist bl = createBlacklist( "# comment\n \t" + someUri + " \n # comment\n\n"); assertTrue(bl.isBlacklisted(someUri)); }
@Test public void testRegexpMatches() throws Exception { GadgetBlacklist bl = createBlacklist("REGEXP http: assertTrue(bl.isBlacklisted(someUri)); assertTrue(bl.isBlacklisted(Uri.parse("http: assertFalse(bl.isBlacklisted(Uri.parse("http: }