use of alfio.manager.FileUploadManager in project alf.io by alfio-event.
the class TemplateProcessorTest method assertDimensionsUnder300x150.
private void assertDimensionsUnder300x150(Pair<String, String> p) {
Map<String, String> parameters = new HashMap<>();
parameters.put(FileBlobMetadata.ATTR_IMG_WIDTH, p.getLeft());
parameters.put(FileBlobMetadata.ATTR_IMG_HEIGHT, p.getRight());
FileBlobMetadata metadata = mock(FileBlobMetadata.class);
when(metadata.getAttributes()).thenReturn(parameters);
Event e = mock(Event.class);
when(e.getFileBlobIdIsPresent()).thenReturn(true);
FileUploadManager fileUploadManager = mock(FileUploadManager.class);
when(fileUploadManager.findMetadata(e.getFileBlobId())).thenReturn(Optional.of(metadata));
TemplateProcessor.extractImageModel(e, fileUploadManager).ifPresent(imageData -> {
assertTrue(imageData.getImageWidth() <= 300);
assertTrue(imageData.getImageHeight() <= 150);
});
}
Aggregations