while(triples.hasNext()) {
resources.add(triples.next().getSubject());
}
triples.close();
Facading facading = FacadingFactory.createFacading(connectionRDF);
// test individual resource
URI u_hans_meier = connectionRDF.getValueFactory().createURI("http://localhost:8080/LMF/resource/hans_meier");
URI u_anna_schmidt = connectionRDF.getValueFactory().createURI("http://localhost:8080/LMF/resource/anna_schmidt");
Person hans_meier = facading.createFacade(u_hans_meier,Person.class);
Assert.assertEquals("Hans Meier",hans_meier.getName());
Assert.assertEquals(2,hans_meier.getFriends().size());
Assert.assertThat(hans_meier.getOnlineAccounts(),
CoreMatchers.<OnlineAccount> hasItem(hasProperty("accountName", is("Example"))));
Assert.assertThat(hans_meier.getFriends(), allOf(
CoreMatchers.<Person> hasItem(hasProperty("name", is("Anna Schmidt"))),
CoreMatchers.<Person> hasItem(hasProperty("name", is("Sepp Huber")))
));
// test collection
Collection<Person> persons = facading.createFacade(resources,Person.class);
Assert.assertEquals(3, persons.size());
Assert.assertThat(persons,allOf(
CoreMatchers.<Person> hasItem(hasProperty("name", is("Hans Meier"))),
CoreMatchers.<Person> hasItem(hasProperty("name", is("Anna Schmidt"))),
CoreMatchers.<Person> hasItem(hasProperty("name", is("Sepp Huber")))