}
@Test
public void testImportBlacklistedSites() throws IOException {
BlacklistedSite site1 = new BlacklistedSite();
site1.setId(1L);
site1.setUri("http://foo.com");
BlacklistedSite site2 = new BlacklistedSite();
site2.setId(2L);
site2.setUri("http://bar.com");
BlacklistedSite site3 = new BlacklistedSite();
site3.setId(3L);
site3.setUri("http://baz.com");
String configJson = "{" +
"\"" + MITREidDataService.CLIENTS + "\": [], " +
"\"" + MITREidDataService.ACCESSTOKENS + "\": [], " +
"\"" + MITREidDataService.REFRESHTOKENS + "\": [], " +
"\"" + MITREidDataService.GRANTS + "\": [], " +
"\"" + MITREidDataService.WHITELISTEDSITES + "\": [], " +
"\"" + MITREidDataService.SYSTEMSCOPES + "\": [], " +
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
"\"" + MITREidDataService.BLACKLISTEDSITES + "\": [" +
"{\"id\":1,\"uri\":\"http://foo.com\"}," +
"{\"id\":2,\"uri\":\"http://bar.com\"}," +
"{\"id\":3,\"uri\":\"http://baz.com\"}" +
" ]" +
"}";
System.err.println(configJson);
JsonReader reader = new JsonReader(new StringReader(configJson));
dataService.importData(reader);
verify(blSiteRepository, times(3)).save(capturedBlacklistedSites.capture());
List<BlacklistedSite> savedSites = capturedBlacklistedSites.getAllValues();
assertThat(savedSites.size(), is(3));
assertThat(savedSites.get(0).getUri(), equalTo(site1.getUri()));
assertThat(savedSites.get(1).getUri(), equalTo(site2.getUri()));
assertThat(savedSites.get(2).getUri(), equalTo(site3.getUri()));
}