diff options
author | Tim Allison <tallison@apache.org> | 2017-03-01 15:47:47 +0000 |
---|---|---|
committer | Tim Allison <tallison@apache.org> | 2017-03-01 15:47:47 +0000 |
commit | 1ace11526ee23358489c376040a817f8aee31b7d (patch) | |
tree | 245b120cdf550d539d980657c86644a51905017d /src/scratchpad/testcases/org/apache | |
parent | e36313aff1e735485dd8b6675a9be72bfd366e1c (diff) | |
download | poi-1ace11526ee23358489c376040a817f8aee31b7d.tar.gz poi-1ace11526ee23358489c376040a817f8aee31b7d.zip |
Bug 60795 -- add enum for message class in MAPIMessage; deprecate getMessageClass()
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1784978 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad/testcases/org/apache')
-rw-r--r-- | src/scratchpad/testcases/org/apache/poi/hsmf/TestSimpleFileRead.java | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/scratchpad/testcases/org/apache/poi/hsmf/TestSimpleFileRead.java b/src/scratchpad/testcases/org/apache/poi/hsmf/TestSimpleFileRead.java index bdfff10788..cc902fae34 100644 --- a/src/scratchpad/testcases/org/apache/poi/hsmf/TestSimpleFileRead.java +++ b/src/scratchpad/testcases/org/apache/poi/hsmf/TestSimpleFileRead.java @@ -19,11 +19,10 @@ package org.apache.poi.hsmf; import java.io.IOException; -import org.apache.poi.hsmf.MAPIMessage; -import org.apache.poi.hsmf.exceptions.ChunkNotFoundException; -import org.apache.poi.POIDataSamples; - import junit.framework.TestCase; +import org.apache.poi.POIDataSamples; +import org.apache.poi.hsmf.exceptions.ChunkNotFoundException; +import org.junit.Test; /** * Tests to verify that we can read a simple msg file, that is in plain/text @@ -134,4 +133,25 @@ public final class TestSimpleFileRead extends TestCase { String obtained = mapiMessage.getMessageClass(); TestCase.assertEquals("IPM.Note", obtained); } + + /** + * Check the various message classes + * + * @throws Exception + */ + @Test + public void testReadMessageClass2() throws Exception { + TestCase.assertEquals( + MAPIMessage.MESSAGE_CLASS.NOTE, mapiMessage.getMessageClassEnum()); + + for (String messageClass : new String[]{ + "Appointment", "Contact", "Post", "StickyNote", "Task" + }) { + MAPIMessage.MESSAGE_CLASS mc = new MAPIMessage( + POIDataSamples.getHSMFInstance().getFile("msgClass"+messageClass+".msg") + ).getMessageClassEnum(); + assertTrue( mc + " but expected " + messageClass, + messageClass.equalsIgnoreCase(mc.toString().replaceAll("_", ""))); + } + } } |