private MAPIMessage cyrillic;
private MAPIMessage chinese;
- /**
- * Initialize this test, load up the blank.msg mapi message.
- * @throws Exception
- */
- public TestBasics() throws IOException {
- POIDataSamples samples = POIDataSamples.getHSMFInstance();
- simple = new MAPIMessage(samples.openResourceAsStream("simple_test_msg.msg"));
- quick = new MAPIMessage(samples.openResourceAsStream("quick.msg"));
- outlook30 = new MAPIMessage(samples.openResourceAsStream("outlook_30_msg.msg"));
- attachments = new MAPIMessage(samples.openResourceAsStream("attachment_test_msg.msg"));
- noRecipientAddress = new MAPIMessage(samples.openResourceAsStream("no_recipient_address.msg"));
- unicode = new MAPIMessage(samples.openResourceAsStream("example_received_unicode.msg"));
- cyrillic = new MAPIMessage(samples.openResourceAsStream("cyrillic_message.msg"));
- chinese = new MAPIMessage(samples.openResourceAsStream("chinese-traditional.msg"));
- }
-
- /**
- * Can we always get the recipient's email?
- */
- public void testRecipientEmail() throws Exception {
+ /**
+ * Initialize this test, load up the blank.msg mapi message.
+ * @throws Exception
+ */
+ public TestBasics() throws IOException {
+ POIDataSamples samples = POIDataSamples.getHSMFInstance();
+ simple = new MAPIMessage(samples.openResourceAsStream("simple_test_msg.msg"));
+ quick = new MAPIMessage(samples.openResourceAsStream("quick.msg"));
+ outlook30 = new MAPIMessage(samples.openResourceAsStream("outlook_30_msg.msg"));
+ attachments = new MAPIMessage(samples.openResourceAsStream("attachment_test_msg.msg"));
+ noRecipientAddress = new MAPIMessage(samples.openResourceAsStream("no_recipient_address.msg"));
+ unicode = new MAPIMessage(samples.openResourceAsStream("example_received_unicode.msg"));
+ cyrillic = new MAPIMessage(samples.openResourceAsStream("cyrillic_message.msg"));
+ chinese = new MAPIMessage(samples.openResourceAsStream("chinese-traditional.msg"));
+ }
+
+ /**
+ * Can we always get the recipient's email?
+ */
+ public void testRecipientEmail() throws Exception {
assertEquals("travis@overwrittenstack.com", simple.getRecipientEmailAddress());
assertEquals("kevin.roast@alfresco.org", quick.getRecipientEmailAddress());
assertEquals("nicolas1.23456@free.fr", attachments.getRecipientEmailAddress());
"debbie.payne@pnl.gov; stuart.rose@pnl.gov; randall.scarberry@pnl.gov; Leigh.Williams@pnl.gov",
outlook30.getRecipientEmailAddress()
);
- }
-
- /**
- * Test subject
- */
- public void testSubject() throws Exception {
+ }
+
+ /**
+ * Test subject
+ */
+ public void testSubject() throws Exception {
assertEquals("test message", simple.getSubject());
assertEquals("Test the content transformer", quick.getSubject());
assertEquals("IN-SPIRE servers going down for a bit, back up around 8am", outlook30.getSubject());
assertEquals("test pi\u00e8ce jointe 1", attachments.getSubject());
- }
-
- /**
- * Test message headers
- */
- public void testHeaders() throws Exception {
- // Simple email first
- assertEquals(26, simple.getHeaders().length);
- assertTrue(simple.getHeaders()[0].startsWith("Return-path:"));
+ }
+
+ /**
+ * Test message headers
+ */
+ public void testHeaders() throws Exception {
+ // Simple email first
+ assertEquals(26, simple.getHeaders().length);
+ assertTrue(simple.getHeaders()[0].startsWith("Return-path:"));
assertTrue(simple.getHeaders()[1].equals("Envelope-to: travis@overwrittenstack.com"));
assertTrue(simple.getHeaders()[25].startsWith("X-Antivirus-Scanner: Clean"));
assertTrue(outlook30.getHeaders()[0].startsWith("Microsoft Mail Internet Headers"));
assertTrue(outlook30.getHeaders()[1].startsWith("x-mimeole:"));
assertTrue(outlook30.getHeaders()[32].startsWith("\t\"Williams")); // May need better parsing in future
- }
-
- /**
- * Test attachments
- */
- public void testAttachments() throws Exception {
+ }
+
+ /**
+ * Test attachments
+ */
+ public void testAttachments() throws Exception {
assertEquals(0, simple.getAttachmentFiles().length);
assertEquals(0, quick.getAttachmentFiles().length);
assertEquals(0, outlook30.getAttachmentFiles().length);
assertEquals(2, attachments.getAttachmentFiles().length);
- }
-
- /**
- * Test missing chunks.
- * Use a file with no HTML body
- */
- public void testMissingChunks() throws Exception {
- assertEquals(false, attachments.isReturnNullOnMissingChunk());
-
- try {
- attachments.getHtmlBody();
- fail();
- } catch(ChunkNotFoundException e) {
- // Good
- }
-
- attachments.setReturnNullOnMissingChunk(true);
-
- assertEquals(null, attachments.getHtmlBody());
+ }
+
+ /**
+ * Test missing chunks.
+ * Use a file with no HTML body
+ */
+ public void testMissingChunks() throws Exception {
+ assertEquals(false, attachments.isReturnNullOnMissingChunk());
+
+ try {
+ attachments.getHtmlBody();
+ fail();
+ } catch(ChunkNotFoundException e) {
+ // Good
+ }
+
+ attachments.setReturnNullOnMissingChunk(true);
+
+ assertEquals(null, attachments.getHtmlBody());
attachments.setReturnNullOnMissingChunk(false);
} catch(ChunkNotFoundException e) {
// Good
}
- }
-
- /**
- * More missing chunk testing, this time for
- * missing recipient email address
- */
- public void testMissingAddressChunk() throws Exception {
+ }
+
+ /**
+ * More missing chunk testing, this time for
+ * missing recipient email address
+ */
+ public void testMissingAddressChunk() throws Exception {
assertEquals(false, noRecipientAddress.isReturnNullOnMissingChunk());
try {
assertEquals("New Outlook User", noRecipientAddress.getDisplayTo());
noRecipientAddress.setReturnNullOnMissingChunk(false);
- }
-
- /**
- * Test the 7 bit detection
- */
- public void test7BitDetection() throws Exception {
- assertEquals(false, unicode.has7BitEncodingStrings());
+ }
+
+ /**
+ * Test the 7 bit detection
+ */
+ public void test7BitDetection() throws Exception {
+ assertEquals(false, unicode.has7BitEncodingStrings());
assertEquals(true, simple.has7BitEncodingStrings());
assertEquals(true, chinese.has7BitEncodingStrings());
assertEquals(true, cyrillic.has7BitEncodingStrings());
- }
+ }
/**
* We default to CP1252, but can sometimes do better
/**
* Tests to verify that the library can read blank msg files.
- *
- * @author Travis Ferguson
- *
*/
public final class TestBlankFileRead extends TestCase {
- private MAPIMessage mapiMessage;
+ private MAPIMessage mapiMessage;
- /**
- * Initialize this test, load up the blank.msg mapi message.
- */
- public TestBlankFileRead() throws IOException {
+ /**
+ * Initialize this test, load up the blank.msg mapi message.
+ */
+ public TestBlankFileRead() throws IOException {
POIDataSamples samples = POIDataSamples.getHSMFInstance();
- this.mapiMessage = new MAPIMessage(samples.openResourceAsStream("blank.msg"));
- }
-
- /**
- * Check if we can read the body of the blank message, we expect "".
- */
- public void testReadBody() {
- try {
- mapiMessage.getTextBody();
- } catch(ChunkNotFoundException exp) {
- return;
- }
-
- TestCase.fail("Should have thrown a ChunkNotFoundException but didn't");
- }
-
-
- /**
- * Test to see if we can read the CC Chunk.
- */
- public void testReadDisplayCC() throws ChunkNotFoundException {
- String obtained = mapiMessage.getDisplayCC();
- String expected = "";
-
- TestCase.assertEquals(expected, obtained);
- }
-
- /**
- * Test to see if we can read the CC Chunk.
- */
- public void testReadDisplayTo() throws ChunkNotFoundException {
- String obtained = mapiMessage.getDisplayTo();
- String expected = "";
-
- TestCase.assertEquals(expected, obtained);
- }
-
- /**
- * Test to see if we can read the FROM Chunk.
- */
- public void testReadDisplayFrom() {
- try {
- mapiMessage.getDisplayFrom();
- } catch(ChunkNotFoundException exp) {
- return;
- }
-
- TestCase.fail("Should have thrown a ChunkNotFoundException but didn't");
- }
-
- /**
- * Test to see if we can read the CC Chunk.
- */
- public void testReadDisplayBCC() throws ChunkNotFoundException {
- String obtained = mapiMessage.getDisplayBCC();
- String expected = "";
-
- TestCase.assertEquals(expected, obtained);
- }
-
-
- /**
- * Check if we can read the subject line of the blank message, we expect ""
- */
- public void testReadSubject() throws Exception {
- String obtained = mapiMessage.getSubject();
- TestCase.assertEquals("", obtained);
- }
-
-
- /**
- * Check if we can read the subject line of the blank message, we expect ""
- */
- public void testReadConversationTopic() {
- try {
- mapiMessage.getConversationTopic();
- } catch(ChunkNotFoundException exp) {
- return;
- }
- TestCase.fail("We shouldn't have a ConversationTopic node on the blank.msg file.");
- }
-
-
+ this.mapiMessage = new MAPIMessage(samples.openResourceAsStream("blank.msg"));
+ }
+
+ /**
+ * Check if we can read the body of the blank message, we expect "".
+ */
+ public void testReadBody() {
+ try {
+ mapiMessage.getTextBody();
+ } catch(ChunkNotFoundException exp) {
+ return;
+ }
+
+ TestCase.fail("Should have thrown a ChunkNotFoundException but didn't");
+ }
+
+
+ /**
+ * Test to see if we can read the CC Chunk.
+ */
+ public void testReadDisplayCC() throws ChunkNotFoundException {
+ String obtained = mapiMessage.getDisplayCC();
+ String expected = "";
+
+ TestCase.assertEquals(expected, obtained);
+ }
+
+ /**
+ * Test to see if we can read the CC Chunk.
+ */
+ public void testReadDisplayTo() throws ChunkNotFoundException {
+ String obtained = mapiMessage.getDisplayTo();
+ String expected = "";
+
+ TestCase.assertEquals(expected, obtained);
+ }
+
+ /**
+ * Test to see if we can read the FROM Chunk.
+ */
+ public void testReadDisplayFrom() {
+ try {
+ mapiMessage.getDisplayFrom();
+ } catch(ChunkNotFoundException exp) {
+ return;
+ }
+
+ TestCase.fail("Should have thrown a ChunkNotFoundException but didn't");
+ }
+
+ /**
+ * Test to see if we can read the CC Chunk.
+ */
+ public void testReadDisplayBCC() throws ChunkNotFoundException {
+ String obtained = mapiMessage.getDisplayBCC();
+ String expected = "";
+
+ TestCase.assertEquals(expected, obtained);
+ }
+
+
+ /**
+ * Check if we can read the subject line of the blank message, we expect ""
+ */
+ public void testReadSubject() throws Exception {
+ String obtained = mapiMessage.getSubject();
+ TestCase.assertEquals("", obtained);
+ }
+
+
+ /**
+ * Check if we can read the subject line of the blank message, we expect ""
+ */
+ public void testReadConversationTopic() {
+ try {
+ mapiMessage.getConversationTopic();
+ } catch(ChunkNotFoundException exp) {
+ return;
+ }
+ TestCase.fail("We shouldn't have a ConversationTopic node on the blank.msg file.");
+ }
}
* ones, for example Submission Dates
*/
public final class TestFixedSizedProperties extends POITestCase {
- protected static final String messageSucceeds = "53784_succeeds.msg";
- protected static final String messageFails = "53784_fails.msg";
- private MAPIMessage mapiMessageSucceeds;
- private MAPIMessage mapiMessageFails;
- private POIFSFileSystem fsMessageSucceeds;
- private POIFSFileSystem fsMessageFails;
+ protected static final String messageSucceeds = "53784_succeeds.msg";
+ protected static final String messageFails = "53784_fails.msg";
+ private MAPIMessage mapiMessageSucceeds;
+ private MAPIMessage mapiMessageFails;
+ private POIFSFileSystem fsMessageSucceeds;
+ private POIFSFileSystem fsMessageFails;
- /**
- * Initialize this test, load up the messages.
- *
- * @throws Exception
- */
- public TestFixedSizedProperties() throws Exception {
- POIDataSamples samples = POIDataSamples.getHSMFInstance();
- this.mapiMessageSucceeds = new MAPIMessage(
- samples.openResourceAsStream(messageSucceeds));
- this.mapiMessageFails = new MAPIMessage(
- samples.openResourceAsStream(messageFails));
- this.fsMessageSucceeds = new POIFSFileSystem(new FileInputStream(samples.getFile(messageSucceeds)));
- this.fsMessageFails = new POIFSFileSystem(new FileInputStream(samples.getFile(messageFails)));
- }
+ /**
+ * Initialize this test, load up the messages.
+ */
+ public TestFixedSizedProperties() throws Exception {
+ POIDataSamples samples = POIDataSamples.getHSMFInstance();
+ this.mapiMessageSucceeds = new MAPIMessage(
+ samples.openResourceAsStream(messageSucceeds));
+ this.mapiMessageFails = new MAPIMessage(
+ samples.openResourceAsStream(messageFails));
+ this.fsMessageSucceeds = new POIFSFileSystem(new FileInputStream(samples.getFile(messageSucceeds)));
+ this.fsMessageFails = new POIFSFileSystem(new FileInputStream(samples.getFile(messageFails)));
+ }
- /**
- * Test to see if we can read the Date Chunk with OutlookTextExtractor.
- * TODO Work out why the Fri 22nd vs Monday 25th problem is occurring and fix
- */
- public void DISABLEDtestReadMessageDateSucceedsWithOutlookTextExtractor() {
- OutlookTextExtactor ext = new OutlookTextExtactor(mapiMessageSucceeds);
- String text = ext.getText();
+ /**
+ * Test to see if we can read the Date Chunk with OutlookTextExtractor.
+ * TODO Work out why the Fri 22nd vs Monday 25th problem is occurring and fix
+ */
+ public void DISABLEDtestReadMessageDateSucceedsWithOutlookTextExtractor() {
+ OutlookTextExtactor ext = new OutlookTextExtactor(mapiMessageSucceeds);
+ String text = ext.getText();
- assertContains(text, "Date: Fri, 22 Jun 2012 21:32:54\n");
- }
+ assertContains(text, "Date: Fri, 22 Jun 2012 21:32:54\n");
+ }
- /**
- * Test to see if we can read the Date Chunk with OutlookTextExtractor.
+ /**
+ * Test to see if we can read the Date Chunk with OutlookTextExtractor.
* TODO Work out why the Thu 21st vs Monday 25th problem is occurring and fix
- */
- public void DISABLEDtestReadMessageDateFailsWithOutlookTextExtractor() {
- OutlookTextExtactor ext = new OutlookTextExtactor(mapiMessageFails);
- String text = ext.getText();
+ */
+ public void DISABLEDtestReadMessageDateFailsWithOutlookTextExtractor() {
+ OutlookTextExtactor ext = new OutlookTextExtactor(mapiMessageFails);
+ String text = ext.getText();
+
+ assertContains(text, "Date: Thu, 21 Jun 2012 17:14:04\n");
+ }
- assertContains(text, "Date: Thu, 21 Jun 2012 17:14:04\n");
- }
-
/**
* Test to see if we can read the Date Chunk with HSMFDump.
* @throws IOException
*/
public void testReadMessageDateSucceedsWithHSMFDump() throws IOException {
- PrintStream stream = new PrintStream(new ByteArrayOutputStream());
- HSMFDump dump = new HSMFDump(fsMessageSucceeds);
- dump.dump(stream);
+ PrintStream stream = new PrintStream(new ByteArrayOutputStream());
+ HSMFDump dump = new HSMFDump(fsMessageSucceeds);
+ dump.dump(stream);
}
-
+
/**
* Test to see if we can read the Date Chunk with HSMFDump.
* @throws Exception
*/
public void testReadMessageDateFailsWithHSMFDump() throws Exception {
- PrintStream stream = new PrintStream(new ByteArrayOutputStream());
- HSMFDump dump = new HSMFDump(fsMessageFails);
- dump.dump(stream);
+ PrintStream stream = new PrintStream(new ByteArrayOutputStream());
+ HSMFDump dump = new HSMFDump(fsMessageFails);
+ dump.dump(stream);
}
-
+
/**
* TODO Work out why the Fri 22nd vs Monday 25th problem is occurring and fix
*/
* Tests to verify that we can still work on the newer Outlook 3.0 files.
*/
public final class TestOutlook30FileRead extends TestCase {
-private MAPIMessage mapiMessage;
+ private MAPIMessage mapiMessage;
- /**
- * Initialize this test, load up the blank.msg mapi message.
- * @throws Exception
- */
- public TestOutlook30FileRead() throws IOException {
+ /**
+ * Initialize this test, load up the blank.msg mapi message.
+ * @throws Exception
+ */
+ public TestOutlook30FileRead() throws IOException {
POIDataSamples samples = POIDataSamples.getHSMFInstance();
- this.mapiMessage = new MAPIMessage(samples.openResourceAsStream("outlook_30_msg.msg"));
- }
-
- /**
- * Test to see if we can read the CC Chunk.
- * @throws ChunkNotFoundException
- *
- */
- public void testReadDisplayCC() throws ChunkNotFoundException {
- String obtained = mapiMessage.getDisplayCC();
- String expected = "";
-
- TestCase.assertEquals(obtained, expected);
- }
-
- /**
- * Test to see if we can read the CC Chunk.
- * @throws ChunkNotFoundException
- *
- */
- public void testReadDisplayTo() throws ChunkNotFoundException {
- String obtained = mapiMessage.getDisplayTo();
-
- assertTrue(obtained.startsWith("Bohn, Shawn"));
- }
-
- /**
- * Test to see if we can read the From Chunk.
- * @throws ChunkNotFoundException
- *
- */
- public void testReadDisplayFrom() throws ChunkNotFoundException {
- String obtained = mapiMessage.getDisplayFrom();
- String expected = "Cramer, Nick";
-
- TestCase.assertEquals(obtained, expected);
- }
-
- /**
- * Test to see if we can read the CC Chunk.
- * @throws ChunkNotFoundException
- *
- */
- public void testReadDisplayBCC() throws ChunkNotFoundException {
- String obtained = mapiMessage.getDisplayBCC();
- String expected = "";
-
- TestCase.assertEquals(obtained, expected);
- }
-
-
- /**
- * Check if we can read the body of the blank message, we expect "".
- *
- * @throws Exception
- */
- public void testReadBody() throws Exception {
- String obtained = mapiMessage.getTextBody();
- assertTrue(obtained.startsWith("I am shutting down"));
- }
-
- /**
- * Check if we can read the subject line of the blank message, we expect ""
- *
- * @throws Exception
- */
- public void testReadSubject() throws Exception {
- String obtained = mapiMessage.getSubject();
- String expected = "IN-SPIRE servers going down for a bit, back up around 8am";
-
- TestCase.assertEquals(expected, obtained);
- }
-
- /**
- * Check if we can read the subject line of the blank message, we expect ""
- *
- * @throws Exception
- */
- public void testReadConversationTopic() throws Exception {
- String obtained = mapiMessage.getConversationTopic();
- TestCase.assertEquals("IN-SPIRE servers going down for a bit, back up around 8am", obtained);
- }
-
- /**
- * Check if we can read the subject line of the blank message, we expect ""
- *
- * @throws Exception
- */
- public void testReadMessageClass() throws Exception {
- String obtained = mapiMessage.getMessageClass();
- TestCase.assertEquals("IPM.Note", obtained);
- }
-
- /**
- * Ensure we can get the HTML and RTF versions
- */
- public void testReadBodyContents() throws Exception {
- String html = mapiMessage.getHtmlBody();
- String rtf = mapiMessage.getRtfBody();
- assertNotNull(html);
- assertNotNull(rtf);
-
- assertTrue("Wrong text:\n" + html, html.startsWith("<!DOCTYPE"));
- assertTrue("Wrong text:\n" + rtf, rtf.startsWith("{\\rtf1"));
- }
+ this.mapiMessage = new MAPIMessage(samples.openResourceAsStream("outlook_30_msg.msg"));
+ }
+
+ /**
+ * Test to see if we can read the CC Chunk.
+ * @throws ChunkNotFoundException
+ *
+ */
+ public void testReadDisplayCC() throws ChunkNotFoundException {
+ String obtained = mapiMessage.getDisplayCC();
+ String expected = "";
+
+ TestCase.assertEquals(obtained, expected);
+ }
+
+ /**
+ * Test to see if we can read the CC Chunk.
+ * @throws ChunkNotFoundException
+ *
+ */
+ public void testReadDisplayTo() throws ChunkNotFoundException {
+ String obtained = mapiMessage.getDisplayTo();
+
+ assertTrue(obtained.startsWith("Bohn, Shawn"));
+ }
+
+ /**
+ * Test to see if we can read the From Chunk.
+ * @throws ChunkNotFoundException
+ *
+ */
+ public void testReadDisplayFrom() throws ChunkNotFoundException {
+ String obtained = mapiMessage.getDisplayFrom();
+ String expected = "Cramer, Nick";
+
+ TestCase.assertEquals(obtained, expected);
+ }
+
+ /**
+ * Test to see if we can read the CC Chunk.
+ * @throws ChunkNotFoundException
+ *
+ */
+ public void testReadDisplayBCC() throws ChunkNotFoundException {
+ String obtained = mapiMessage.getDisplayBCC();
+ String expected = "";
+
+ TestCase.assertEquals(obtained, expected);
+ }
+
+
+ /**
+ * Check if we can read the body of the blank message, we expect "".
+ *
+ * @throws Exception
+ */
+ public void testReadBody() throws Exception {
+ String obtained = mapiMessage.getTextBody();
+ assertTrue(obtained.startsWith("I am shutting down"));
+ }
+
+ /**
+ * Check if we can read the subject line of the blank message, we expect ""
+ *
+ * @throws Exception
+ */
+ public void testReadSubject() throws Exception {
+ String obtained = mapiMessage.getSubject();
+ String expected = "IN-SPIRE servers going down for a bit, back up around 8am";
+
+ TestCase.assertEquals(expected, obtained);
+ }
+
+ /**
+ * Check if we can read the subject line of the blank message, we expect ""
+ *
+ * @throws Exception
+ */
+ public void testReadConversationTopic() throws Exception {
+ String obtained = mapiMessage.getConversationTopic();
+ TestCase.assertEquals("IN-SPIRE servers going down for a bit, back up around 8am", obtained);
+ }
+
+ /**
+ * Check if we can read the subject line of the blank message, we expect ""
+ *
+ * @throws Exception
+ */
+ public void testReadMessageClass() throws Exception {
+ String obtained = mapiMessage.getMessageClass();
+ TestCase.assertEquals("IPM.Note", obtained);
+ }
+
+ /**
+ * Ensure we can get the HTML and RTF versions
+ */
+ public void testReadBodyContents() throws Exception {
+ String html = mapiMessage.getHtmlBody();
+ String rtf = mapiMessage.getRtfBody();
+ assertNotNull(html);
+ assertNotNull(rtf);
+
+ assertTrue("Wrong text:\n" + html, html.startsWith("<!DOCTYPE"));
+ assertTrue("Wrong text:\n" + rtf, rtf.startsWith("{\\rtf1"));
+ }
}
import junit.framework.TestCase;
/**
- * Tests to verify that we can read a simple msg file, that is in plain/text format with no attachments
- * or extra recipents.
- *
- * @author Travis Ferguson
+ * Tests to verify that we can read a simple msg file, that is in plain/text
+ * format with no attachments or extra recipents.
*/
public final class TestSimpleFileRead extends TestCase {
-private MAPIMessage mapiMessage;
+ private MAPIMessage mapiMessage;
- /**
- * Initialize this test, load up the blank.msg mapi message.
- * @throws Exception
- */
- public TestSimpleFileRead() throws IOException {
+ /**
+ * Initialize this test, load up the blank.msg mapi message.
+ * @throws Exception
+ */
+ public TestSimpleFileRead() throws IOException {
POIDataSamples samples = POIDataSamples.getHSMFInstance();
- this.mapiMessage = new MAPIMessage(samples.openResourceAsStream("simple_test_msg.msg"));
- }
-
- /**
- * Test to see if we can read the CC Chunk.
- * @throws ChunkNotFoundException
- *
- */
- public void testReadDisplayCC() throws ChunkNotFoundException {
- String obtained = mapiMessage.getDisplayCC();
- String expected = "";
-
- TestCase.assertEquals(obtained, expected);
- }
-
- /**
- * Test to see if we can read the CC Chunk.
- * @throws ChunkNotFoundException
- *
- */
- public void testReadDisplayTo() throws ChunkNotFoundException {
- String obtained = mapiMessage.getDisplayTo();
- String expected = "travis@overwrittenstack.com";
-
- TestCase.assertEquals(obtained, expected);
- }
-
- /**
- * Test to see if we can read the From Chunk.
- * @throws ChunkNotFoundException
- *
- */
- public void testReadDisplayFrom() throws ChunkNotFoundException {
- String obtained = mapiMessage.getDisplayFrom();
- String expected = "Travis Ferguson";
-
- TestCase.assertEquals(obtained, expected);
- }
-
- /**
- * Test to see if we can read the CC Chunk.
- * @throws ChunkNotFoundException
- *
- */
- public void testReadDisplayBCC() throws ChunkNotFoundException {
- String obtained = mapiMessage.getDisplayBCC();
- String expected = "";
-
- TestCase.assertEquals(obtained, expected);
- }
-
-
- /**
- * Check if we can read the body of the blank message, we expect "".
- *
- * @throws Exception
- */
- public void testReadBody() throws Exception {
- String obtained = mapiMessage.getTextBody();
- String expected = "This is a test message.";
-
- TestCase.assertEquals(obtained, expected);
- }
-
- /**
- * Check if we can read the subject line of the blank message, we expect ""
- *
- * @throws Exception
- */
- public void testReadSubject() throws Exception {
- String obtained = mapiMessage.getSubject();
- String expected = "test message";
-
- TestCase.assertEquals(expected, obtained);
- }
-
- /**
- * Check if we can read the subject line of the blank message, we expect ""
- *
- * @throws Exception
- */
- public void testReadConversationTopic() throws Exception {
- String obtained = mapiMessage.getConversationTopic();
- TestCase.assertEquals("test message", obtained);
- }
-
-
- /**
- * Check if we can read the subject line of the blank message, we expect ""
- *
- * @throws Exception
- */
- public void testReadMessageClass() throws Exception {
- String obtained = mapiMessage.getMessageClass();
- TestCase.assertEquals("IPM.Note", obtained);
- }
-
-
-
+ this.mapiMessage = new MAPIMessage(samples.openResourceAsStream("simple_test_msg.msg"));
+ }
+
+ /**
+ * Test to see if we can read the CC Chunk.
+ * @throws ChunkNotFoundException
+ *
+ */
+ public void testReadDisplayCC() throws ChunkNotFoundException {
+ String obtained = mapiMessage.getDisplayCC();
+ String expected = "";
+
+ TestCase.assertEquals(obtained, expected);
+ }
+
+ /**
+ * Test to see if we can read the CC Chunk.
+ * @throws ChunkNotFoundException
+ *
+ */
+ public void testReadDisplayTo() throws ChunkNotFoundException {
+ String obtained = mapiMessage.getDisplayTo();
+ String expected = "travis@overwrittenstack.com";
+
+ TestCase.assertEquals(obtained, expected);
+ }
+
+ /**
+ * Test to see if we can read the From Chunk.
+ * @throws ChunkNotFoundException
+ *
+ */
+ public void testReadDisplayFrom() throws ChunkNotFoundException {
+ String obtained = mapiMessage.getDisplayFrom();
+ String expected = "Travis Ferguson";
+
+ TestCase.assertEquals(obtained, expected);
+ }
+
+ /**
+ * Test to see if we can read the CC Chunk.
+ * @throws ChunkNotFoundException
+ *
+ */
+ public void testReadDisplayBCC() throws ChunkNotFoundException {
+ String obtained = mapiMessage.getDisplayBCC();
+ String expected = "";
+
+ TestCase.assertEquals(obtained, expected);
+ }
+
+
+ /**
+ * Check if we can read the body of the blank message, we expect "".
+ *
+ * @throws Exception
+ */
+ public void testReadBody() throws Exception {
+ String obtained = mapiMessage.getTextBody();
+ String expected = "This is a test message.";
+
+ TestCase.assertEquals(obtained, expected);
+ }
+
+ /**
+ * Check if we can read the subject line of the blank message, we expect ""
+ *
+ * @throws Exception
+ */
+ public void testReadSubject() throws Exception {
+ String obtained = mapiMessage.getSubject();
+ String expected = "test message";
+
+ TestCase.assertEquals(expected, obtained);
+ }
+
+ /**
+ * Check if we can read the subject line of the blank message, we expect ""
+ *
+ * @throws Exception
+ */
+ public void testReadConversationTopic() throws Exception {
+ String obtained = mapiMessage.getConversationTopic();
+ TestCase.assertEquals("test message", obtained);
+ }
+
+
+ /**
+ * Check if we can read the subject line of the blank message, we expect ""
+ *
+ * @throws Exception
+ */
+ public void testReadMessageClass() throws Exception {
+ String obtained = mapiMessage.getMessageClass();
+ TestCase.assertEquals("IPM.Note", obtained);
+ }
}