@Test
public void testJPEGTitleAndDescription() throws Exception {

    Metadata metadata = new Metadata();
    metadata.set(Metadata.CONTENT_TYPE, "image/jpeg");
    try (InputStream stream = getClass().getResourceAsStream("/test-documents/testJPEG_commented.jpg")) {
        parser.parse(stream, new DefaultHandler(), metadata, new ParseContext());
    }
    // embedded comments with non-ascii characters
    assertEquals("Tosteberga \u00C4ngar", metadata.get(TikaCoreProperties.TITLE));
    assertEquals("Bird site in north eastern Sk\u00E5ne, Sweden.\n(new line)", metadata.get(TikaCoreProperties.DESCRIPTION));
    assertEquals("Some Tourist", metadata.get(TikaCoreProperties.CREATOR)); // Dublin Core
    // xmp handles spaces in keywords, returns "bird watching, nature reserve, coast, grazelands"
    // but we have to replace them with underscore
    List<String> keywords = Arrays.asList(metadata.getValues(TikaCoreProperties.SUBJECT));
    assertTrue(keywords.contains("coast"));
    assertTrue(keywords.contains("bird watching"));
    // Core EXIF/TIFF tags
    assertEquals("103", metadata.get(Metadata.IMAGE_WIDTH));
    assertEquals("77", metadata.get(Metadata.IMAGE_LENGTH));
    assertEquals("8", metadata.get(Metadata.BITS_PER_SAMPLE));
    assertEquals(null, metadata.get(Metadata.SAMPLES_PER_PIXEL));
    assertEquals("1.0E-6", metadata.get(Metadata.EXPOSURE_TIME)); // 1/1000000
    assertEquals("2.8", metadata.get(Metadata.F_NUMBER));
    assertEquals("4.6", metadata.get(Metadata.FOCAL_LENGTH));
    assertEquals("114", metadata.get(Metadata.ISO_SPEED_RATINGS));
    assertEquals(null, metadata.get(Metadata.EQUIPMENT_MAKE));
    assertEquals(null, metadata.get(Metadata.EQUIPMENT_MODEL));
    assertEquals(null, metadata.get(Metadata.SOFTWARE));
    assertEquals("1", metadata.get(Metadata.ORIENTATION)); // Not present
    assertEquals("300.0", metadata.get(Metadata.RESOLUTION_HORIZONTAL));
    assertEquals("300.0", metadata.get(Metadata.RESOLUTION_VERTICAL));
    assertEquals("Inch", metadata.get(Metadata.RESOLUTION_UNIT));
    //ICC
    assertEquals("IEC", metadata.get("ICC:Device manufacturer").trim());
    assertNull(metadata.get("Device manufacturer"));
}