public class Bzip2ParserTest extends AbstractPkgTest {
@Test
public void testBzip2Parsing() throws Exception {
Parser parser = new AutoDetectParser(); // Should auto-detect!
ContentHandler handler = new BodyContentHandler();
Metadata metadata = new Metadata();
InputStream stream = Bzip2ParserTest.class.getResourceAsStream(
"/test-documents/test-documents.tbz2");
try {
parser.parse(stream, handler, metadata, recursingContext);
} finally {
stream.close();
}
assertEquals("application/x-bzip2", metadata.get(Metadata.CONTENT_TYPE));
String content = handler.toString();
assertTrue(content.contains("test-documents/testEXCEL.xls"));
assertTrue(content.contains("Sample Excel Worksheet"));
assertTrue(content.contains("test-documents/testHTML.html"));
assertTrue(content.contains("Test Indexation Html"));
assertTrue(content.contains("test-documents/testOpenOffice2.odt"));