improve error message

This commit is contained in:
Grahame Grieve 2020-07-22 12:29:25 +10:00
parent 0d8aec0db5
commit 8950a129b7
1 changed files with 7 additions and 7 deletions

View File

@ -213,7 +213,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
else
val.validate(null, errors, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.XML);
System.out.println(val.reportTimes());
checkOutcomes(errors, content);
checkOutcomes(errors, content, null);
if (content.has("profile")) {
System.out.print("** Profile: ");
JsonObject profile = content.getAsJsonObject("profile");
@ -244,7 +244,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
else
val.validate(null, errorsProfile, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.XML, asSdList(sd));
System.out.println(val.reportTimes());
checkOutcomes(errorsProfile, profile);
checkOutcomes(errorsProfile, profile, filename);
}
if (content.has("logical")) {
JsonObject logical = content.getAsJsonObject("logical");
@ -268,7 +268,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
Assert.assertTrue(fp.evaluateToBoolean(null, le, le, le, fp.parse(exp)));
}
}
checkOutcomes(errorsLogical, logical);
checkOutcomes(errorsLogical, logical, "logical");
}
}
@ -330,7 +330,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
}
}
private void checkOutcomes(List<ValidationMessage> errors, JsonObject focus) {
private void checkOutcomes(List<ValidationMessage> errors, JsonObject focus, String profile) {
JsonObject java = focus.getAsJsonObject("java");
int ec = 0;
int wc = 0;
@ -358,11 +358,11 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
}
}
if (!TestingUtilities.context(version).isNoTerminologyServer() || !focus.has("tx-dependent")) {
Assert.assertEquals("Test " + name + ": Expected " + Integer.toString(java.get("errorCount").getAsInt()) + " errors, but found " + Integer.toString(ec) + ".", java.get("errorCount").getAsInt(), ec);
Assert.assertEquals("Test " + name + (profile == null ? "" : " profile: "+ profile) + ": Expected " + Integer.toString(java.get("errorCount").getAsInt()) + " errors, but found " + Integer.toString(ec) + ".", java.get("errorCount").getAsInt(), ec);
if (java.has("warningCount"))
Assert.assertEquals( "Test " + name + ": Expected " + Integer.toString(java.get("warningCount").getAsInt()) + " warnings, but found " + Integer.toString(wc) + ".", java.get("warningCount").getAsInt(), wc);
Assert.assertEquals( "Test " + name + (profile == null ? "" : " profile: "+ profile) + ": Expected " + Integer.toString(java.get("warningCount").getAsInt()) + " warnings, but found " + Integer.toString(wc) + ".", java.get("warningCount").getAsInt(), wc);
if (java.has("infoCount"))
Assert.assertEquals( "Test " + name + ": Expected " + Integer.toString(java.get("infoCount").getAsInt()) + " hints, but found " + Integer.toString(hc) + ".", java.get("infoCount").getAsInt(), hc);
Assert.assertEquals( "Test " + name + (profile == null ? "" : " profile: "+ profile) + ": Expected " + Integer.toString(java.get("infoCount").getAsInt()) + " hints, but found " + Integer.toString(hc) + ".", java.get("infoCount").getAsInt(), hc);
}
if (java.has("error-locations")) {
JsonArray el = java.getAsJsonArray("error-locations");