aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2016-12-13 00:30:24 +0000
committerAndreas Beeker <kiwiwings@apache.org>2016-12-13 00:30:24 +0000
commitbaffa07ce7480f15de4fa74b53173d9118be419e (patch)
treea3cd87b326ba0422db360beb52b22acc48c9fbab /src/testcases
parent68810a63baf5eb5156d895ad347a4378eefd1706 (diff)
downloadpoi-baffa07ce7480f15de4fa74b53173d9118be419e.tar.gz
poi-baffa07ce7480f15de4fa74b53173d9118be419e.zip
eclipse warnings - raw list access
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1773905 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r--src/testcases/org/apache/poi/poifs/property/TestPropertyFactory.java18
-rw-r--r--src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java30
2 files changed, 23 insertions, 25 deletions
diff --git a/src/testcases/org/apache/poi/poifs/property/TestPropertyFactory.java b/src/testcases/org/apache/poi/poifs/property/TestPropertyFactory.java
index e6d2c656a6..3628712984 100644
--- a/src/testcases/org/apache/poi/poifs/property/TestPropertyFactory.java
+++ b/src/testcases/org/apache/poi/poifs/property/TestPropertyFactory.java
@@ -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 extends TestCase {
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 extends TestCase {
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());
}
}
}
diff --git a/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java b/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java
index 52e4aafc19..3950ce07e2 100644
--- a/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java
+++ b/src/testcases/org/apache/poi/poifs/property/TestPropertyTable.java
@@ -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 extends TestCase {
* 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 extends TestCase {
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);