summaryrefslogtreecommitdiffstats
path: root/poi-integration/src
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2021-08-28 23:48:48 +0000
committerAndreas Beeker <kiwiwings@apache.org>2021-08-28 23:48:48 +0000
commitf71cebcce5ed809ee15cd69524f8cb0b0b2ea47c (patch)
tree4f9f798ae3acd7a3e50a675becbe85055d1beff6 /poi-integration/src
parent6d9b450ce31209014d945a13c65fc23cb29a351c (diff)
downloadpoi-f71cebcce5ed809ee15cd69524f8cb0b0b2ea47c.tar.gz
poi-f71cebcce5ed809ee15cd69524f8cb0b0b2ea47c.zip
sonar fixes
close resources in tests fix gradle warnings git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1892683 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-integration/src')
-rw-r--r--poi-integration/src/test/java/org/apache/poi/stress/BaseIntegrationTest.java1
-rw-r--r--poi-integration/src/test/java/org/apache/poi/stress/XSSFFileHandler.java12
2 files changed, 9 insertions, 4 deletions
diff --git a/poi-integration/src/test/java/org/apache/poi/stress/BaseIntegrationTest.java b/poi-integration/src/test/java/org/apache/poi/stress/BaseIntegrationTest.java
index 47a80d198b..2ae90a930d 100644
--- a/poi-integration/src/test/java/org/apache/poi/stress/BaseIntegrationTest.java
+++ b/poi-integration/src/test/java/org/apache/poi/stress/BaseIntegrationTest.java
@@ -37,6 +37,7 @@ import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
* types of files/exceptions, e.g. old file formats.
*
*/
+@SuppressWarnings({"java:S2187", "unused"})
public class BaseIntegrationTest {
private final File rootDir;
private final String file;
diff --git a/poi-integration/src/test/java/org/apache/poi/stress/XSSFFileHandler.java b/poi-integration/src/test/java/org/apache/poi/stress/XSSFFileHandler.java
index 6f9571564f..ba60188040 100644
--- a/poi-integration/src/test/java/org/apache/poi/stress/XSSFFileHandler.java
+++ b/poi-integration/src/test/java/org/apache/poi/stress/XSSFFileHandler.java
@@ -17,6 +17,8 @@
package org.apache.poi.stress;
import static org.apache.commons.io.output.NullOutputStream.NULL_OUTPUT_STREAM;
+import static org.apache.poi.xssf.XSSFTestDataSamples.getSampleFile;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -219,12 +221,14 @@ class XSSFFileHandler extends SpreadsheetHandler {
}
@Test
- void testExtracting() throws Exception {
- handleExtracting(new File("test-data/spreadsheet/ref-56737.xlsx"));
+ void testExtracting() {
+ File testFile = getSampleFile("ref-56737.xlsx");
+ assertDoesNotThrow(() -> handleExtracting(testFile));
}
@Test
- void testAdditional() throws Exception {
- handleAdditional(new File("test-data/spreadsheet/poc-xmlbomb.xlsx"));
+ void testAdditional() {
+ File testFile = getSampleFile("poc-xmlbomb.xlsx");
+ assertDoesNotThrow(() -> handleAdditional(testFile));
}
}