use of eu.europeana.metis.schema.jibx.ProvidedCHOType in project metis-framework by europeana.
the class RdfWrapperTest method testGetAbout.
@Test
void testGetAbout() {
// Create entities
final ProvidedCHOType entity0 = mock(ProvidedCHOType.class);
doReturn(" ").when(entity0).getAbout();
final ProvidedCHOType entity1 = mock(ProvidedCHOType.class);
doReturn("nonemptyabout").when(entity1).getAbout();
final ProvidedCHOType entity2 = mock(ProvidedCHOType.class);
doReturn(null).when(entity2).getAbout();
// Test rdf that returns a real list
final RDF rdf = mock(RDF.class);
when(rdf.getProvidedCHOList()).thenReturn(Arrays.asList(entity0, entity1, entity2, null));
assertEquals(entity1.getAbout(), new RdfWrapper(rdf).getAbout());
// Test rdf that returns list without viable candidates
when(rdf.getProvidedCHOList()).thenReturn(Arrays.asList(entity0, entity2));
assertNull(new RdfWrapper(rdf).getAbout());
// Test rdf that returns null
when(rdf.getProvidedCHOList()).thenReturn(null);
assertNull(new RdfWrapper(rdf).getAbout());
}
use of eu.europeana.metis.schema.jibx.ProvidedCHOType in project metis-framework by europeana.
the class EuropeanaIdCreatorTest method createRdf.
private static RDF createRdf(String... ids) {
final List<ProvidedCHOType> providedChos = new ArrayList<>();
for (String id : ids) {
final ProvidedCHOType providedCho = new ProvidedCHOType();
if (id != null) {
providedCho.setAbout(id);
}
providedChos.add(providedCho);
}
final RDF rdf = new RDF();
rdf.setProvidedCHOList(providedChos);
return rdf;
}
Aggregations