Search in sources :

Example 16 with LabelResource

use of eu.europeana.enrichment.api.external.model.LabelResource in project metis-framework by europeana.

the class ItemExtractorUtilsTest method extractLabelResources.

@Test
void extractLabelResources() {
    List<LabelResource> labelResources = new ArrayList<>();
    LabelResource labelResource1 = new LabelResource("resource1");
    LabelResource labelResource2 = new LabelResource("resource2");
    LabelResource labelResource3 = new LabelResource("resource3");
    labelResources.add(labelResource1);
    labelResources.add(labelResource2);
    labelResources.add(labelResource3);
    List<ResourceOrLiteralType> output = ItemExtractorUtils.extractLabelResources(labelResources, ResourceOrLiteralType::new);
    for (LabelResource labelResource : labelResources) {
        List<ResourceOrLiteralType> result = output.stream().filter(x -> x.getResource().getResource().equals(labelResource.getResource())).collect(Collectors.toList());
        assertEquals(1, result.size());
    }
}
Also used : Label(eu.europeana.enrichment.api.external.model.Label) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) EnrichmentBase(eu.europeana.enrichment.api.external.model.EnrichmentBase) Lang(eu.europeana.metis.schema.jibx.LiteralType.Lang) AltLabel(eu.europeana.metis.schema.jibx.AltLabel) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) Choice(eu.europeana.metis.schema.jibx.Concept.Choice) Collectors(java.util.stream.Collectors) ResourceOrLiteralType(eu.europeana.metis.schema.jibx.ResourceOrLiteralType) ArrayList(java.util.ArrayList) ResourceType(eu.europeana.metis.schema.jibx.ResourceType) Test(org.junit.jupiter.api.Test) AboutType(eu.europeana.metis.schema.jibx.AboutType) List(java.util.List) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) LiteralType(eu.europeana.metis.schema.jibx.LiteralType) Part(eu.europeana.enrichment.api.external.model.Part) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) Agent(eu.europeana.enrichment.api.external.model.Agent) LabelResource(eu.europeana.enrichment.api.external.model.LabelResource) Resource(eu.europeana.enrichment.api.external.model.Resource) LabelResource(eu.europeana.enrichment.api.external.model.LabelResource) ArrayList(java.util.ArrayList) ResourceOrLiteralType(eu.europeana.metis.schema.jibx.ResourceOrLiteralType) Test(org.junit.jupiter.api.Test)

Aggregations

LabelResource (eu.europeana.enrichment.api.external.model.LabelResource)16 Label (eu.europeana.enrichment.api.external.model.Label)7 ResourceOrLiteralType (eu.europeana.metis.schema.jibx.ResourceOrLiteralType)6 Test (org.junit.jupiter.api.Test)6 Part (eu.europeana.enrichment.api.external.model.Part)5 Place (eu.europeana.enrichment.api.external.model.Place)4 ArrayList (java.util.ArrayList)4 Agent (eu.europeana.enrichment.api.external.model.Agent)3 TimeSpan (eu.europeana.enrichment.api.external.model.TimeSpan)3 Resource (eu.europeana.enrichment.api.external.model.Resource)2 EnrichmentBase (eu.europeana.enrichment.api.external.model.EnrichmentBase)1 AboutType (eu.europeana.metis.schema.jibx.AboutType)1 AltLabel (eu.europeana.metis.schema.jibx.AltLabel)1 Choice (eu.europeana.metis.schema.jibx.Concept.Choice)1 LiteralType (eu.europeana.metis.schema.jibx.LiteralType)1 Lang (eu.europeana.metis.schema.jibx.LiteralType.Lang)1 ResourceType (eu.europeana.metis.schema.jibx.ResourceType)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)1