diff options
author | Dominik Stadler <centic@apache.org> | 2022-07-29 17:07:05 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2022-07-29 17:07:05 +0000 |
commit | 92b8cf9984ba767d10f224d0bc3fa41b01fbcf32 (patch) | |
tree | 633228429903b677eef970e8a43456cc8743a154 /poi/src/test | |
parent | 5c78170f5de235dc9a4bb0ded7f4afe3f0ee5a43 (diff) | |
download | poi-92b8cf9984ba767d10f224d0bc3fa41b01fbcf32.tar.gz poi-92b8cf9984ba767d10f224d0bc3fa41b01fbcf32.zip |
Also look for test-data in parent-directory
When using the IDE to run tests in one of the
sub-modules uses the poi-* sub-directory, so
looking for the test-data in ../test-data is
useful to make executing tests work out-of-the-box
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1903103 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi/src/test')
-rw-r--r-- | poi/src/test/java/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java | 3 | ||||
-rw-r--r-- | poi/src/test/java/org/apache/poi/hssf/model/TestDrawingAggregate.java | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/poi/src/test/java/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java b/poi/src/test/java/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java index 065fe6a70a..5ec8a30b23 100644 --- a/poi/src/test/java/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java +++ b/poi/src/test/java/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java @@ -50,7 +50,8 @@ public abstract class BaseTestIteratingXLS { }; public Stream<Arguments> files() { - String dataDirName = System.getProperty(POIDataSamples.TEST_PROPERTY, "test-data"); + String dataDirName = System.getProperty(POIDataSamples.TEST_PROPERTY, + new File("test-data").exists() ? "test-data" : "../test-data"); DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir(dataDirName); diff --git a/poi/src/test/java/org/apache/poi/hssf/model/TestDrawingAggregate.java b/poi/src/test/java/org/apache/poi/hssf/model/TestDrawingAggregate.java index 90bd30c3c5..6b99428aea 100644 --- a/poi/src/test/java/org/apache/poi/hssf/model/TestDrawingAggregate.java +++ b/poi/src/test/java/org/apache/poi/hssf/model/TestDrawingAggregate.java @@ -33,6 +33,7 @@ import java.util.Map; import java.util.stream.Stream; import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream; +import org.apache.poi.POIDataSamples; import org.apache.poi.ddf.DefaultEscherRecordFactory; import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherDggRecord; @@ -127,7 +128,12 @@ class TestDrawingAggregate { } public static Stream<Arguments> samples() { - File testData = new File(System.getProperty("POI.testdata.path"), "spreadsheet"); + String property = System.getProperty(POIDataSamples.TEST_PROPERTY, "test-data"); + File testData = new File(property, "spreadsheet"); + if (!testData.exists()) { + testData = new File("../" + property, "spreadsheet"); + } + File[] files = testData.listFiles((dir, name) -> name.endsWith(".xls")); assertNotNull(files, "Need to find files in test-data path, had path: " + testData); return Stream.of(files).map(Arguments::of); |