aboutsummaryrefslogtreecommitdiffstats
path: root/src/integrationtest
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2020-03-29 12:16:10 +0000
committerDominik Stadler <centic@apache.org>2020-03-29 12:16:10 +0000
commita68b67a70bcb57131add0e602e9521b2112c1ed4 (patch)
treea0669e7cc85602937da563cdb0ee1a837c7d547d /src/integrationtest
parentcc1b6557ee514aa2f9997b104c42a09aae3400e3 (diff)
downloadpoi-a68b67a70bcb57131add0e602e9521b2112c1ed4.tar.gz
poi-a68b67a70bcb57131add0e602e9521b2112c1ed4.zip
Support building with Gradle in POIFileScanner tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1875849 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/integrationtest')
-rw-r--r--src/integrationtest/org/apache/poi/POIFileScanner.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/integrationtest/org/apache/poi/POIFileScanner.java b/src/integrationtest/org/apache/poi/POIFileScanner.java
index db6030f738..a8220ec8e7 100644
--- a/src/integrationtest/org/apache/poi/POIFileScanner.java
+++ b/src/integrationtest/org/apache/poi/POIFileScanner.java
@@ -51,6 +51,16 @@ import static org.junit.Assert.assertEquals;
* Can also be used to get the appropriate FileHandler for a single file.
*/
public class POIFileScanner {
+ private final static File ROOT_DIR;
+ static {
+ // when running in Gradle, current directory might be "build/integrationtest"
+ if(new File("../../test-data").exists()) {
+ ROOT_DIR = new File("../../test-data");
+ } else {
+ ROOT_DIR = new File("test-data");
+ }
+ }
+
/**
* Scan a folder for files and return a collection of
* found files together with the matching {@link FileHandler}.
@@ -195,11 +205,11 @@ public class POIFileScanner {
@Test
public void testDetectUnnamedFile() throws IOException {
- POIFileScanner.detectUnnamedFile(new File("test-data/spreadsheet"), "49156.xlsx");
+ POIFileScanner.detectUnnamedFile(new File(ROOT_DIR, "spreadsheet"), "49156.xlsx");
}
@Test
public void test() throws IOException {
- POIFileScanner.scan(new File("test-data"));
+ POIFileScanner.scan(ROOT_DIR);
}
}