Search in sources :

Example 1 with JpegCommentDirectory

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);
}
Also used : JpegCommentDirectory(com.drew.metadata.jpeg.JpegCommentDirectory) Metadata(org.apache.tika.metadata.Metadata) Iterator(java.util.Iterator) ExifSubIFDDirectory(com.drew.metadata.exif.ExifSubIFDDirectory) Directory(com.drew.metadata.Directory) ExifIFD0Directory(com.drew.metadata.exif.ExifIFD0Directory) JpegCommentDirectory(com.drew.metadata.jpeg.JpegCommentDirectory) Test(org.junit.Test)

Aggregations

Directory (com.drew.metadata.Directory)1 ExifIFD0Directory (com.drew.metadata.exif.ExifIFD0Directory)1 ExifSubIFDDirectory (com.drew.metadata.exif.ExifSubIFDDirectory)1 JpegCommentDirectory (com.drew.metadata.jpeg.JpegCommentDirectory)1 Iterator (java.util.Iterator)1 Metadata (org.apache.tika.metadata.Metadata)1 Test (org.junit.Test)1