Add failing test to test build

This commit is contained in:
Grahame Grieve 2020-09-09 07:04:08 +10:00
parent 5828b4c75f
commit 2bb46f2046

View File

@ -224,7 +224,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
else else
val.validate(null, errors, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.XML); val.validate(null, errors, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.XML);
System.out.println(val.reportTimes()); System.out.println(val.reportTimes());
checkOutcomes(errors, content, null); checkOutcomes(errors, content, null, name);
} }
if (content.has("profile")) { if (content.has("profile")) {
System.out.print("** Profile: "); System.out.print("** Profile: ");
@ -256,7 +256,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
else else
val.validate(null, errorsProfile, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.XML, asSdList(sd)); val.validate(null, errorsProfile, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.XML, asSdList(sd));
System.out.println(val.reportTimes()); System.out.println(val.reportTimes());
checkOutcomes(errorsProfile, profile, filename); checkOutcomes(errorsProfile, profile, filename, name);
} }
if (content.has("logical")) { if (content.has("logical")) {
JsonObject logical = content.getAsJsonObject("logical"); JsonObject logical = content.getAsJsonObject("logical");
@ -280,7 +280,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
Assert.assertTrue(fp.evaluateToBoolean(null, le, le, le, fp.parse(exp))); Assert.assertTrue(fp.evaluateToBoolean(null, le, le, le, fp.parse(exp)));
} }
} }
checkOutcomes(errorsLogical, logical, "logical"); checkOutcomes(errorsLogical, logical, "logical", name);
} }
} }
@ -342,7 +342,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
} }
} }
private void checkOutcomes(List<ValidationMessage> errors, JsonObject focus, String profile) { private void checkOutcomes(List<ValidationMessage> errors, JsonObject focus, String profile, String name) {
JsonObject java = focus.getAsJsonObject("java"); JsonObject java = focus.getAsJsonObject("java");
int ec = 0; int ec = 0;
int wc = 0; int wc = 0;
@ -371,6 +371,9 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
} }
if (!TestingUtilities.context(version).isNoTerminologyServer() || !focus.has("tx-dependent")) { if (!TestingUtilities.context(version).isNoTerminologyServer() || !focus.has("tx-dependent")) {
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); 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 (name.equals("icd-9-condition.xml")) {
Assert.assertEquals("Test " + name + (profile == null ? "" : " profile: "+ profile) + ": Expected " + Integer.toString(1) + " errors, but found " + Integer.toString(ec) + ".", 1, ec);
}
if (java.has("warningCount")) { if (java.has("warningCount")) {
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); 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);
} }