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 ea73cb013e
commit 1cff226bcc
1 changed files with 6 additions and 2 deletions

View File

@ -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()) {