use of com.drew.metadata.jpeg.JpegCommentDirectory in project tika by apache.
the class ImageMetadataExtractorTest method testHandleDirectories.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testHandleDirectories() throws MetadataException {
Metadata metadata = mock(Metadata.class);
ImageMetadataExtractor.DirectoryHandler handler1 = mock(ImageMetadataExtractor.DirectoryHandler.class);
ImageMetadataExtractor e = new ImageMetadataExtractor(metadata, handler1);
Directory directory = new JpegCommentDirectory();
Iterator directories = mock(Iterator.class);
when(directories.hasNext()).thenReturn(true, false);
when(directories.next()).thenReturn(directory);
when(handler1.supports(JpegCommentDirectory.class)).thenReturn(true);
e.handle(directories);
verify(handler1).supports(JpegCommentDirectory.class);
verify(handler1).handle(directory, metadata);
}
Aggregations