From: Dominik Stadler Date: Mon, 5 Oct 2015 06:45:20 +0000 (+0000) Subject: As discussed at ApacheCon: Try to automatically find test-data in unit tests, this... X-Git-Tag: REL_3_14_BETA1~271 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1cff226bcc1fcd235d4147eab9560a0be494b2d3;p=poi.git As discussed at ApacheCon: Try to automatically find test-data in unit tests, this makes it easier to get going in Eclipse or other IDEs. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1706752 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/testcases/org/apache/poi/POIDataSamples.java b/src/testcases/org/apache/poi/POIDataSamples.java index a62e664e1e..8ff09d9083 100644 --- a/src/testcases/org/apache/poi/POIDataSamples.java +++ b/src/testcases/org/apache/poi/POIDataSamples.java @@ -197,8 +197,12 @@ public final class POIDataSamples { return; } - throw new RuntimeException("Must set system property '" + - TEST_PROPERTY + "' before running tests"); + if(new File("test-data").exists()) { + dataDirName = "test-data"; + } else { + throw new RuntimeException("Must set system property '" + + TEST_PROPERTY + "' before running tests"); + } } File dataDir = new File(dataDirName, _moduleDir); if (!dataDir.exists()) {