*/
public class OutlookParserTest extends TestCase {
public void testOutlookParsing() throws Exception {
Parser parser = new AutoDetectParser(); // Should auto-detect!
ContentHandler handler = new BodyContentHandler();
Metadata metadata = new Metadata();
InputStream stream = OutlookParserTest.class.getResourceAsStream(
"/test-documents/test-outlook.msg");
try {
parser.parse(stream, handler, metadata);
} finally {
stream.close();
}
assertEquals(
"application/vnd.ms-outlook",
metadata.get(Metadata.CONTENT_TYPE));
assertEquals(
"Microsoft Outlook Express 6",
metadata.get(Metadata.TITLE));
// TODO: There's apparently some encoding issue in POI
//assertEquals(
// "L'\u00C9quipe Microsoft Outlook Express",
// metadata.get(Metadata.AUTHOR));
String content = handler.toString();
assertTrue(content.contains("Microsoft Outlook Express 6"));
//assertTrue(content.contains("L'\u00C9quipe Microsoft Outlook Express"));
assertTrue(content.contains("Nouvel utilisateur de Outlook Express"));
assertTrue(content.contains("Messagerie et groupes de discussion"));
}