Search in sources :

Example 1 with ProvidedCHOType

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());
}
Also used : RDF(eu.europeana.metis.schema.jibx.RDF) ProvidedCHOType(eu.europeana.metis.schema.jibx.ProvidedCHOType) Test(org.junit.jupiter.api.Test)

Example 2 with ProvidedCHOType

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;
}
Also used : RDF(eu.europeana.metis.schema.jibx.RDF) ProvidedCHOType(eu.europeana.metis.schema.jibx.ProvidedCHOType) ArrayList(java.util.ArrayList)

Aggregations

ProvidedCHOType (eu.europeana.metis.schema.jibx.ProvidedCHOType)2 RDF (eu.europeana.metis.schema.jibx.RDF)2 ArrayList (java.util.ArrayList)1 Test (org.junit.jupiter.api.Test)1