aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/TestPOITestCase.java
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2019-12-30 00:08:24 +0000
committerAndreas Beeker <kiwiwings@apache.org>2019-12-30 00:08:24 +0000
commit71338b958c551f3a7282fe2ac8edd45c33f27d51 (patch)
treec30f3ba8c83b731cc740f14d4a7181317e8672fe /src/testcases/org/apache/poi/TestPOITestCase.java
parenta0770034fcc878a697b715d0b6a6e53406b2d02d (diff)
downloadpoi-71338b958c551f3a7282fe2ac8edd45c33f27d51.tar.gz
poi-71338b958c551f3a7282fe2ac8edd45c33f27d51.zip
Sonar fixes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1872092 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/TestPOITestCase.java')
-rw-r--r--src/testcases/org/apache/poi/TestPOITestCase.java53
1 files changed, 25 insertions, 28 deletions
diff --git a/src/testcases/org/apache/poi/TestPOITestCase.java b/src/testcases/org/apache/poi/TestPOITestCase.java
index 796f51335f..42310738fa 100644
--- a/src/testcases/org/apache/poi/TestPOITestCase.java
+++ b/src/testcases/org/apache/poi/TestPOITestCase.java
@@ -17,10 +17,20 @@
package org.apache.poi;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
import java.util.Collections;
import java.util.Locale;
import java.util.Map;
+import org.apache.poi.poifs.filesystem.DirectoryNode;
+import org.apache.poi.poifs.filesystem.DocumentEntry;
+import org.apache.poi.poifs.filesystem.EntryNode;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.poifs.property.PropertyTable;
import org.junit.Ignore;
import org.junit.Test;
@@ -41,7 +51,7 @@ public final class TestPOITestCase {
POITestCase.assertEndsWith("Apache POI", "POI");
POITestCase.assertEndsWith("Apache POI", "Apache POI");
}
-
+
@Test
public void assertContains() {
POITestCase.assertContains("There is a needle in this haystack", "needle");
@@ -78,45 +88,32 @@ public final class TestPOITestCase {
// FIXME: test failing case
}
-
+
/**
* Utility method to get the value of a private/protected field.
* Only use this method in test cases!!!
*/
- @Ignore
@Test
- public void getFieldValue() {
- /*
- final Class<? super T> clazz;
- final T instance;
- final Class<R> fieldType;
- final String fieldName;
-
- final R expected;
- final R actual = POITestCase.getFieldValue(clazz, instance, fieldType, fieldName);
- assertEquals(expected, actual);
- */
+ public void getFieldValue() throws IOException {
+ try (POIFSFileSystem fs = new POIFSFileSystem()) {
+ PropertyTable actual = POITestCase.getFieldValue(POIFSFileSystem.class, fs, PropertyTable.class, "_property_table");
+ assertNotNull(actual);
+ }
}
-
+
/**
* Utility method to call a private/protected method.
* Only use this method in test cases!!!
*/
@Ignore
@Test
- public void callMethod() {
- /*
- final Class<? super T> clazz;
- final T instance;
- final Class<R> returnType;
- final String methodName;
- final Class<?>[] parameterTypes;
- final Object[] parameters;
-
- final R expected;
- final R actual = POITestCase.callMethod(clazz, instance, returnType, methodName, parameterTypes, parameters);
- assertEquals(expected, actual);
- */
+ public void callMethod() throws IOException {
+ try (POIFSFileSystem fs = new POIFSFileSystem()) {
+ DirectoryNode root = fs.getRoot();
+ DocumentEntry doc = fs.createDocument(new ByteArrayInputStream(new byte[]{1, 2, 3}), "foobaa");
+ boolean actual = POITestCase.callMethod(DirectoryNode.class, root, boolean.class, "deleteEntry", new Class[]{EntryNode.class}, new Object[]{doc});
+ assertTrue(actual);
+ }
}
/**