protected void handle(com.drew.metadata.Metadata metadataExtractor) throws MetadataException {
        handle(metadataExtractor.getDirectories().iterator());
    }
@SuppressWarnings({"rawtypes", "unchecked"})
    @Test
    public void testHandleDirectories() throws MetadataException {
        Metadata metadata = Mockito.mock(Metadata.class);
        ImageMetadataExtractor.DirectoryHandler handler1 =
                Mockito.mock(ImageMetadataExtractor.DirectoryHandler.class);
        ImageMetadataExtractor e = new ImageMetadataExtractor(metadata, handler1);

        Directory directory = new JpegCommentDirectory();
        Iterator directories = Mockito.mock(Iterator.class);
        Mockito.when(directories.hasNext()).thenReturn(true, false);
        Mockito.when(directories.next()).thenReturn(directory);
        Mockito.when(handler1.supports(JpegCommentDirectory.class)).thenReturn(true);

        e.handle(directories);
        Mockito.verify(handler1).supports(JpegCommentDirectory.class);
        Mockito.verify(handler1).handle(directory, metadata);
    }