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);