@Test
public void testParseJpeg() throws IOException, TikaException {

    Metadata metadata = new Metadata();
    try (InputStream stream = getClass().getResourceAsStream("/test-documents/testJPEG_commented.jpg")) {
        // set some values before extraction to see that they are overridden
        metadata.set(TikaCoreProperties.TITLE, "old title");
        metadata.set(TikaCoreProperties.DESCRIPTION, "old description");
        metadata.set(TikaCoreProperties.CREATOR, "previous author");
        // ... or kept in case the field is multi-value
        metadata.add(TikaCoreProperties.SUBJECT, "oldkeyword");
        JempboxExtractor extractor = new JempboxExtractor(metadata);
        extractor.parse(stream);
        // DublinCore fields
        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));
        Collection<String> keywords = Arrays.asList(metadata.getValues(TikaCoreProperties.SUBJECT));
        assertTrue(keywords.contains("oldkeyword"));
        assertTrue(keywords.contains("grazelands"));
        assertTrue(keywords.contains("nature reserve"));
        assertTrue(keywords.contains("bird watching"));
        assertTrue(keywords.contains("coast"));
    }
}