use of eu.europeana.metis.schema.jibx.ResourceOrLiteralType in project metis-framework by europeana.
the class ItemExtractorUtilsTest method testExtractLabelResourceWithoutLanguage.
@Test
void testExtractLabelResourceWithoutLanguage() {
LabelResource label = new LabelResource(null, "value1");
label.setResource("resource1");
ResourceOrLiteralType output = ItemExtractorUtils.extractLabelResource(label, ResourceOrLiteralType::new);
assertNotNull(output);
assertEquals("value1", output.getString());
assertNull(output.getLang());
assertEquals("resource1", output.getResource().getResource());
}
use of eu.europeana.metis.schema.jibx.ResourceOrLiteralType in project metis-framework by europeana.
the class ItemExtractorUtilsTest method testExtractPartNullResource.
@Test
void testExtractPartNullResource() {
Part part = new Part(null);
ResourceOrLiteralType output = ItemExtractorUtils.extractPart(part, ResourceOrLiteralType::new);
assertNotNull(output);
assertEquals("", output.getString());
assertNull(output.getResource());
}
use of eu.europeana.metis.schema.jibx.ResourceOrLiteralType in project metis-framework by europeana.
the class ItemExtractorUtilsTest method testExtractLabelResourceWithoutResource.
@Test
void testExtractLabelResourceWithoutResource() {
LabelResource label = new LabelResource("lang1", "value1");
ResourceOrLiteralType output = ItemExtractorUtils.extractLabelResource(label, ResourceOrLiteralType::new);
assertNotNull(output);
assertEquals("value1", output.getString());
assertEquals("lang1", output.getLang().getLang());
assertNull(output.getResource());
}
use of eu.europeana.metis.schema.jibx.ResourceOrLiteralType in project metis-framework by europeana.
the class ItemExtractorUtilsTest method testExtractLabelResource.
@Test
void testExtractLabelResource() {
LabelResource label = new LabelResource("lang1", "value1");
label.setResource("resource1");
ResourceOrLiteralType output = ItemExtractorUtils.extractLabelResource(label, ResourceOrLiteralType::new);
assertNotNull(output);
assertEquals("value1", output.getString());
assertEquals("lang1", output.getLang().getLang());
assertEquals("resource1", output.getResource().getResource());
}
use of eu.europeana.metis.schema.jibx.ResourceOrLiteralType in project metis-framework by europeana.
the class LanguageTagStatisticsTest method testAddToStatisticsForChoice.
private <T extends ResourceOrLiteralType> void testAddToStatisticsForChoice(T value, BiConsumer<Choice, T> setter, PropertyType propertyType) {
final LanguageTagStatistics statistics = spy(new LanguageTagStatistics(null, null, null));
Choice choice = new Choice();
setter.accept(choice, value);
statistics.addToStatistics(choice);
verify(statistics, times(1)).addToStatistics(value, propertyType);
verify(statistics, times(1)).addToStatistics(any(ResourceOrLiteralType.class), any());
verify(statistics, never()).addToStatistics(any(LiteralType.class), any());
}
Aggregations