From cb70afed0caf90a19cdff3930f41552f3e0f17c4 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 8 Nov 2019 11:51:01 +1100 Subject: [PATCH] Add better error message to tests --- .../org/hl7/fhir/r5/test/utils/TestingUtilities.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/test/utils/TestingUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/test/utils/TestingUtilities.java index 6ed842090..3409abcf7 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/test/utils/TestingUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/test/utils/TestingUtilities.java @@ -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); } }