You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2016/12/13 00:30:24 UTC
svn commit: r1773905 - in
/poi/trunk/src/testcases/org/apache/poi/poifs/property:
TestPropertyFactory.java TestPropertyTable.java
Author: kiwiwings
Date: Tue Dec 13 00:30:24 2016
New Revision: 1773905
URL: http://svn.apache.org/viewvc?rev=1773905&view=rev
Log:
eclipse warnings - raw list access
Modified:
poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyFactory.java
poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyFactory.java?rev=1773905&r1=1773904&r2=1773905&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyFactory.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyFactory.java Tue Dec 13 00:30:24 2016
@@ -17,22 +17,25 @@
package org.apache.poi.poifs.property;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.List;
-import junit.framework.TestCase;
-
import org.apache.poi.poifs.storage.RawDataBlock;
import org.apache.poi.poifs.storage.RawDataUtil;
+import org.junit.Test;
/**
* Class to test PropertyFactory functionality
- *
- * @author Marc Johnson
*/
-public final class TestPropertyFactory extends TestCase {
+public final class TestPropertyFactory {
+ @Test
public void testConvertToProperties() throws IOException {
// real data from a real file!
@@ -302,7 +305,7 @@ public final class TestPropertyFactory e
for (int j = 0; j < raw_data.length; j++) {
raw_data[j] = new RawDataBlock(stream);
}
- List properties = PropertyFactory.convertToProperties(raw_data);
+ List<Property> properties = PropertyFactory.convertToProperties(raw_data);
assertEquals(64, properties.size());
String[] names = {
@@ -388,8 +391,7 @@ public final class TestPropertyFactory e
assertTrue("Checking property " + j,
properties.get(j) instanceof DocumentProperty);
}
- assertEquals("Checking property " + j, names[j], ((Property) properties.get(j))
- .getName());
+ assertEquals("Checking property " + j, names[j], properties.get(j).getName());
}
}
}
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java?rev=1773905&r1=1773904&r2=1773905&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java Tue Dec 13 00:30:24 2016
@@ -17,26 +17,25 @@
package org.apache.poi.poifs.property;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.util.Iterator;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
import org.apache.poi.poifs.common.POIFSConstants;
import org.apache.poi.poifs.storage.BlockAllocationTableReader;
import org.apache.poi.poifs.storage.HeaderBlock;
import org.apache.poi.poifs.storage.RawDataBlockList;
import org.apache.poi.poifs.storage.RawDataUtil;
+import org.junit.Test;
/**
* Class to test PropertyTable functionality
- *
- * @author Marc Johnson
*/
-public final class TestPropertyTable extends TestCase {
+public final class TestPropertyTable {
private static void confirmBlockEncoding(String[] expectedDataHexDumpLines, PropertyTable table) {
byte[] expectedData = RawDataUtil.decode(expectedDataHexDumpLines);
@@ -68,6 +67,7 @@ public final class TestPropertyTable ext
* the preWrite phase first), and comparing it against a real property table
* extracted from a file known to be acceptable to Excel.
*/
+ @Test
public void testWriterPropertyTable() throws IOException {
// create the PropertyTable
@@ -450,21 +450,17 @@ public final class TestPropertyTable ext
assertEquals(30 * 64, table.getRoot().getSize());
int count = 0;
Property child = null;
- Iterator iter = table.getRoot().getChildren();
-
- while (iter.hasNext()) {
- child = (Property) iter.next();
+ for (Property p : table.getRoot()) {
+ child = p;
++count;
}
- if (child == null) {
- throw new AssertionFailedError("no children found");
- }
+
+ assertNotNull("no children found", child);
assertEquals(1, count);
assertTrue(child.isDirectory());
- iter = ((DirectoryProperty) child).getChildren();
count = 0;
- while (iter.hasNext()) {
- iter.next();
+ for (Property p : (DirectoryProperty) child) {
+ child = p;
++count;
}
assertEquals(35, count);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org