@Test
    public void testParsePages() throws Exception {
        Metadata metadata = new Metadata();
        String content = getText("testPages.pages", iWorkParser, metadata);
        // Make sure enough keys came through
        // (Exact numbers will vary based on composites)
        assertTrue(metadata.size() >= 50, "Insufficient metadata found " + metadata.size());
        List<String> metadataKeys = Arrays.asList(metadata.names());
        assertTrue(metadataKeys.contains(Metadata.CONTENT_TYPE),
                "Metadata not found in " + metadataKeys);
        assertTrue(metadataKeys.contains(Office.PAGE_COUNT.getName()),
                "Metadata not found in " + metadataKeys);
        assertTrue(metadataKeys.contains(TikaCoreProperties.CREATOR.getName()),
                "Metadata not found in " + metadataKeys);
        assertTrue(metadataKeys.contains(TikaCoreProperties.TITLE.getName()),
                "Metadata not found in " + metadataKeys);
        assertTrue(metadataKeys.contains(TikaCoreProperties.MODIFIED.getName()),
                "Metadata not found in " + metadataKeys);
        assertTrue(metadataKeys.contains(TikaCoreProperties.LANGUAGE.getName()),
                "Metadata not found in " + metadataKeys);

        // Check the metadata values
        assertEquals("application/vnd.apple.pages", metadata.get(Metadata.CONTENT_TYPE));
        assertEquals("Tika user", metadata.get(TikaCoreProperties.CREATOR));
        assertEquals("Apache tika", metadata.get(TikaCoreProperties.TITLE));
        assertEquals("2010-05-09T21:34:38+0200", metadata.get(TikaCoreProperties.CREATED));
        assertEquals("2010-05-09T23:50:36+0200", metadata.get(TikaCoreProperties.MODIFIED));
        assertEquals("en", metadata.get(TikaCoreProperties.LANGUAGE));
        assertEquals("2", metadata.get(Office.PAGE_COUNT));

        // text on page 1
        assertContains("Sample pages document", content);
        assertContains("Some plain text to parse.", content);
        assertContains("Cell one", content);
        assertContains("Cell two", content);
        assertContains("Cell three", content);
        assertContains("Cell four", content);
        assertContains("Cell five", content);
        assertContains("Cell six", content);
        assertContains("Cell seven", content);
        assertContains("Cell eight", content);
        assertContains("Cell nine", content);
        assertContains("Both Pages 1.x and Keynote 2.x", content); // ...

        // text on page 2
        assertContains("A second page....", content);
        assertContains("Extensible Markup Language", content); // ...
    }
Check the given InputStream is not closed by the Parser (TIKA-1117).

@throws Exception
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-apple-module/src/test/java/org/apache/tika/parser/iwork/IWorkParserTest.java