-
Notifications
You must be signed in to change notification settings - Fork 20
Closed
Labels
Description
BaseCommonTests features a method
protected static String getResourcePath(final String path) {
try {
return new File(BaseCommonTests.class.getResource(path).toURI()).getAbsolutePath();
} catch (final URISyntaxException ex) {
throw new RuntimeException(ex);
}
}
This is really unstable and fails every time under Maven with:
Caused by: java.lang.IllegalArgumentException: URI is not hierarchical
at java.io.File.<init>(File.java:418)
at org.trellisldp.test.BaseCommonTests.getResourcePath(BaseCommonTests.java:104)
at [somewhere that called getResourcePath]
presumably because BaseCommonTests.class.getResource(path).toURI() is indeed not returning an URI that can be used for a file. In fact, I think this might only work in Gradle.
I'm not sure what to do here: ideally, we would decouple fully from build mechanics for tests, because I'm trying to reuse tests for trellis-cassandra-app and this is blocking me. But I certainly don't want to build up a whole resource management machinery instead!
In similar situations in Maven, I've passed in a system property with the absolute build directory. I wouldn't claim that so doing is that much better.