diff options
author | Nick Burch <nick@apache.org> | 2014-05-11 21:16:40 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2014-05-11 21:16:40 +0000 |
commit | aa3a7ef63d3082e1c032716d0d6930bf0b973d97 (patch) | |
tree | 83e06979a03d8e84b4c5ef2d80a5796410a01264 /src/scratchpad/testcases/org/apache/poi/hsmf | |
parent | eb5866370a0020fb3d7df765803babf9b3da5c13 (diff) | |
download | poi-aa3a7ef63d3082e1c032716d0d6930bf0b973d97.tar.gz poi-aa3a7ef63d3082e1c032716d0d6930bf0b973d97.zip |
Based on reading of the new file format docs, start to tweak how fixed length vs variable length / multi-valued properties are handled
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1593861 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad/testcases/org/apache/poi/hsmf')
-rw-r--r-- | src/scratchpad/testcases/org/apache/poi/hsmf/TestFixedSizedProperties.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/scratchpad/testcases/org/apache/poi/hsmf/TestFixedSizedProperties.java b/src/scratchpad/testcases/org/apache/poi/hsmf/TestFixedSizedProperties.java index cf46878572..4108ec0ec9 100644 --- a/src/scratchpad/testcases/org/apache/poi/hsmf/TestFixedSizedProperties.java +++ b/src/scratchpad/testcases/org/apache/poi/hsmf/TestFixedSizedProperties.java @@ -31,6 +31,7 @@ import java.util.TimeZone; import org.apache.poi.POIDataSamples; import org.apache.poi.POITestCase; import org.apache.poi.hsmf.datatypes.ChunkBasedPropertyValue; +import org.apache.poi.hsmf.datatypes.Chunks; import org.apache.poi.hsmf.datatypes.MAPIProperty; import org.apache.poi.hsmf.datatypes.PropertyValue; import org.apache.poi.hsmf.datatypes.PropertyValue.LongPropertyValue; @@ -86,9 +87,12 @@ public final class TestFixedSizedProperties extends POITestCase { * Check we find properties of a variety of different types */ public void testPropertyValueTypes() throws Exception { - Map<MAPIProperty,List<PropertyValue>> props = - mapiMessageSucceeds.getMainChunks().getProperties(); - HashSet<Class<? extends PropertyValue>> seenTypes = new HashSet<Class<? extends PropertyValue>>(); + Chunks mainChunks = mapiMessageSucceeds.getMainChunks(); + + // Ask to have the values looked up + Map<MAPIProperty,List<PropertyValue>> props = mainChunks.getProperties(); + HashSet<Class<? extends PropertyValue>> seenTypes = + new HashSet<Class<? extends PropertyValue>>(); for (List<PropertyValue> pvs : props.values()) { for (PropertyValue pv : pvs) { seenTypes.add(pv.getClass()); @@ -97,6 +101,16 @@ public final class TestFixedSizedProperties extends POITestCase { assertTrue(seenTypes.toString(), seenTypes.size() > 3); assertTrue(seenTypes.toString(), seenTypes.contains(LongPropertyValue.class)); assertTrue(seenTypes.toString(), seenTypes.contains(TimePropertyValue.class)); + assertFalse(seenTypes.toString(), seenTypes.contains(ChunkBasedPropertyValue.class)); + + // Ask for the raw values + seenTypes.clear(); + for (PropertyValue pv : mainChunks.getRawProperties().values()) { + seenTypes.add(pv.getClass()); + } + assertTrue(seenTypes.toString(), seenTypes.size() > 3); + assertTrue(seenTypes.toString(), seenTypes.contains(LongPropertyValue.class)); + assertTrue(seenTypes.toString(), seenTypes.contains(TimePropertyValue.class)); assertTrue(seenTypes.toString(), seenTypes.contains(ChunkBasedPropertyValue.class)); } |