i got a Java project which has multiple test directorys at resources.
\target\test-classes
|___conf
| |_ items...
|___otherdata
|_ items...
I need to access \target\test-classes
at it's root, so I can switch between directories since a testcase uses files from BOTH directories at once.
Tried:
File targetClassesDir = new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath());
File targetDir = targetClassesDir.getParentFile();
and
getClass().getResource("test-classes").getPath()
but counldn't access the root of test-classes
yet.
I've constructed a pretty shitty workaround...:
tuple4TestsuiteContainer.add(new HeaderBodyPayloadTestcase(
"conf\\" + xqueries[0],
getClass().getResource("/").getPath(),
"xquery-testdata\\" + file.substring(file.lastIndexOf(File.separatorChar) + 1),
"xquery-testdata\\" +expectedFiles[0].substring(expectedFiles[0].lastIndexOf(File.separatorChar) + 1)
));
and in the actual tester:
String xqueryFileContent = readFile(testDataBasePath + xQueryUnderTestPath, encoding);