public void testExifHandlerParseDateError() throws MetadataException {
ExifDirectory exif = mock(ExifDirectory.class);
when(exif.containsTag(ExifDirectory.TAG_DATETIME_ORIGINAL)).thenReturn(true);
when(exif.getDate(ExifDirectory.TAG_DATETIME_ORIGINAL)).thenThrow(
new MetadataException("Tag 'X' cannot be cast to a java.util.Date."));
Metadata metadata = new Metadata();
new ImageMetadataExtractor.ExifHandler().handle(exif, metadata);
assertEquals("Parsing should proceed without date", null,
metadata.get(TikaCoreProperties.CREATED));