You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by kl...@apache.org on 2003/09/13 14:32:12 UTC
cvs commit: jakarta-poi/src/testcases/org/apache/poi/hpsf/basic TestBasic.java TestEmptyProperties.java
klute 2003/09/13 05:32:12
Modified: src/testcases/org/apache/poi/hpsf/basic TestBasic.java
TestEmptyProperties.java
Log:
Test cases updated/enhanced.
Revision Changes Path
1.9 +30 -8 jakarta-poi/src/testcases/org/apache/poi/hpsf/basic/TestBasic.java
Index: TestBasic.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/testcases/org/apache/poi/hpsf/basic/TestBasic.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TestBasic.java 4 Sep 2003 20:15:24 -0000 1.8
+++ TestBasic.java 13 Sep 2003 12:32:11 -0000 1.9
@@ -60,18 +60,21 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.util.List;
import junit.framework.Assert;
import junit.framework.TestCase;
+import org.apache.poi.hpsf.ClassID;
import org.apache.poi.hpsf.DocumentSummaryInformation;
import org.apache.poi.hpsf.HPSFException;
import org.apache.poi.hpsf.MarkUnsupportedException;
import org.apache.poi.hpsf.NoPropertySetStreamException;
import org.apache.poi.hpsf.PropertySet;
import org.apache.poi.hpsf.PropertySetFactory;
+import org.apache.poi.hpsf.Section;
import org.apache.poi.hpsf.SummaryInformation;
-import org.apache.poi.hpsf.UnexpectedPropertySetTypeException;
+import org.apache.poi.hpsf.wellknown.SectionIDMap;
@@ -138,7 +141,6 @@
final File dataDir =
new File(System.getProperty("HPSF.testdata.path"));
final File data = new File(dataDir, POI_FS);
-
poiFiles = Util.readPOIFiles(data);
}
@@ -192,10 +194,6 @@
{
o = ex;
}
- catch (UnexpectedPropertySetTypeException ex)
- {
- o = ex;
- }
catch (MarkUnsupportedException ex)
{
o = ex;
@@ -217,7 +215,6 @@
*/
public void testPropertySetMethods() throws IOException, HPSFException
{
-
/* Loop over the two property sets. */
for (int i = 0; i < 2; i++)
{
@@ -235,6 +232,31 @@
Assert.assertEquals(ps.isDocumentSummaryInformation(),
IS_DOCUMENT_SUMMARY_INFORMATION[i]);
}
+ }
+
+
+
+ /**
+ * <p>Tests the {@link Section} methods. The test file has two
+ * property sets: the first one is a {@link SummaryInformation},
+ * the second one is a {@link DocumentSummaryInformation}.</p>
+ *
+ * @exception IOException if an I/O exception occurs
+ * @exception HPSFException if any HPSF exception occurs
+ */
+ public void testSectionMethods() throws IOException, HPSFException
+ {
+ final SummaryInformation si = (SummaryInformation)
+ PropertySetFactory.create(new ByteArrayInputStream
+ (poiFiles[0].getBytes()));
+ final List sections = si.getSections();
+ final Section s = (Section) sections.get(0);
+ Assert.assertTrue(org.apache.poi.hpsf.Util.equal
+ (s.getFormatID().getBytes(), SectionIDMap.SUMMARY_INFORMATION_ID));
+ Assert.assertNotNull(s.getProperties());
+ Assert.assertEquals(17, s.getPropertyCount());
+ Assert.assertEquals("Titel", s.getProperty(2));
+ Assert.assertEquals(1764, s.getSize());
}
1.2 +2 -6 jakarta-poi/src/testcases/org/apache/poi/hpsf/basic/TestEmptyProperties.java
Index: TestEmptyProperties.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/testcases/org/apache/poi/hpsf/basic/TestEmptyProperties.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestEmptyProperties.java 26 Jul 2003 21:24:53 -0000 1.1
+++ TestEmptyProperties.java 13 Sep 2003 12:32:11 -0000 1.2
@@ -122,10 +122,6 @@
{
o = ex;
}
- catch (UnexpectedPropertySetTypeException ex)
- {
- o = ex;
- }
catch (MarkUnsupportedException ex)
{
o = ex;
@@ -159,7 +155,7 @@
assertNotNull(s.getTemplate());
assertNotNull(s.getLastAuthor());
assertNotNull(s.getRevNumber());
- assertNull(s.getEditTime());
+ assertEquals(s.getEditTime(), 0);
assertNull(s.getLastPrinted());
assertNull(s.getCreateDateTime());
assertNull(s.getLastSaveDateTime());
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org