Add better error message to tests

This commit is contained in:
Grahame Grieve 2019-11-08 11:51:01 +11:00
parent bcd8ddba34
commit cb70afed0c
1 changed files with 10 additions and 2 deletions

View File

@ -485,7 +485,11 @@ public class TestingUtilities {
return new FileInputStream(n);
} else {
String classpath = ("/org/hl7/fhir/testcases/"+ Utilities.pathURL(paths));
return TestingUtilities.class.getResourceAsStream(classpath);
InputStream s = TestingUtilities.class.getResourceAsStream(classpath);
if (s == null) {
throw new Error("unable to find resource "+classpath);
}
return s;
}
}
@ -495,7 +499,11 @@ public class TestingUtilities {
return TextFile.fileToBytes(n);
} else {
String classpath = ("/org/hl7/fhir/testcases/"+ Utilities.pathURL(paths));
return TextFile.streamToBytes(TestingUtilities.class.getResourceAsStream(classpath));
InputStream s = TestingUtilities.class.getResourceAsStream(classpath);
if (s == null) {
throw new Error("unable to find resource "+classpath);
}
return TextFile.streamToBytes(s);
}
}