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
This commit is contained in:
Dominik Stadler 2015-10-05 06:45:20 +00:00
parent 4b487fcc10
commit cc1caaf658

View File

@ -197,9 +197,13 @@ public final class POIDataSamples {
return; return;
} }
if(new File("test-data").exists()) {
dataDirName = "test-data";
} else {
throw new RuntimeException("Must set system property '" + throw new RuntimeException("Must set system property '" +
TEST_PROPERTY + "' before running tests"); TEST_PROPERTY + "' before running tests");
} }
}
File dataDir = new File(dataDirName, _moduleDir); File dataDir = new File(dataDirName, _moduleDir);
if (!dataDir.exists()) { if (!dataDir.exists()) {
throw new RuntimeException("Data dir '" + _moduleDir + " does not exist"); throw new RuntimeException("Data dir '" + _moduleDir + " does not exist");