use of eu.europeana.metis.schema.jibx.WebResourceType in project metis-framework by europeana.
the class WebResourceTest method testSetChannels.
@Test
void testSetChannels() {
final WebResourceType resourceType = new WebResourceType();
new WebResource(resourceType).setChannels(789);
assertNotNull(resourceType.getAudioChannelNumber());
assertNotNull(resourceType.getAudioChannelNumber().getInteger());
assertEquals(789, resourceType.getAudioChannelNumber().getInteger().intValue());
new WebResource(resourceType).setChannels(null);
assertNull(resourceType.getAudioChannelNumber());
}
use of eu.europeana.metis.schema.jibx.WebResourceType in project metis-framework by europeana.
the class WebResourceTest method testSetMimeType.
@Test
void testSetMimeType() {
final WebResourceType resourceType = new WebResourceType();
new WebResource(resourceType).setMimeType("unknown type");
assertNotNull(resourceType.getHasMimeType());
assertEquals("unknown type", resourceType.getHasMimeType().getHasMimeType());
}
use of eu.europeana.metis.schema.jibx.WebResourceType in project metis-framework by europeana.
the class WebResourceTest method testSetFileSize.
@Test
void testSetFileSize() {
final WebResourceType resourceType = new WebResourceType();
new WebResource(resourceType).setFileSize(456L);
assertNotNull(resourceType.getFileByteSize());
assertEquals(456L, resourceType.getFileByteSize().getLong());
}
use of eu.europeana.metis.schema.jibx.WebResourceType in project metis-framework by europeana.
the class WebResourceTest method testSetWidth.
@Test
void testSetWidth() {
final WebResourceType resourceType = new WebResourceType();
new WebResource(resourceType).setWidth(123);
assertNotNull(resourceType.getWidth());
assertEquals(123L, resourceType.getWidth().getLong());
new WebResource(resourceType).setWidth(null);
assertNull(resourceType.getWidth());
}
use of eu.europeana.metis.schema.jibx.WebResourceType in project metis-framework by europeana.
the class RdfWrapperTest method testGetWebResourcesWithProcessing.
@Test
void testGetWebResourcesWithProcessing() {
// Create entities
final WebResourceType entity0 = mock(WebResourceType.class);
doReturn(" ").when(entity0).getAbout();
final WebResourceType entity1 = mock(WebResourceType.class);
doReturn("nonemptyabout").when(entity1).getAbout();
final WebResourceType entity2 = mock(WebResourceType.class);
doReturn(null).when(entity2).getAbout();
// Test rdf that returns a real list
final RDF rdf = mock(RDF.class);
when(rdf.getWebResourceList()).thenReturn(Arrays.asList(entity0, entity1, entity2, null));
assertEquals(Collections.singletonList(entity1.getAbout()), new RdfWrapper(rdf).getWebResources().stream().map(WebResourceType::getAbout).collect(Collectors.toList()));
// Test rdf that returns null
when(rdf.getWebResourceList()).thenReturn(null);
assertTrue(new RdfWrapper(rdf).getWebResources().isEmpty());
}
Aggregations