Add test case for Json resource parsing

This commit is contained in:
Grahame Grieve 2020-08-10 21:24:04 +10:00
parent 1af6268fa8
commit 4aa8e08681
3 changed files with 23 additions and 2 deletions

View File

@ -0,0 +1,20 @@
package org.hl7.fhir.dstu3.test;
import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import org.hl7.fhir.dstu3.formats.JsonParser;
import org.hl7.fhir.dstu3.model.Resource;
import org.hl7.fhir.dstu3.test.support.TestingUtilities;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.junit.jupiter.api.Test;
class JsonParserTestCase {
@Test
void test() throws FHIRFormatError, IOException {
Resource r = new JsonParser().parse(TestingUtilities.loadTestResourceStream("r3", "ActivityDefinition-referralPrimaryCareMentalHealth.json"));
}
}

View File

@ -41,7 +41,7 @@ public class SingleTest {
public static void main(String[] args) {
try {
ResourceTest r = new ResourceTest();
r.setSource(new File("C:\\work\\org.hl7.fhir\\build\\publish\\patient-example.xml"));
r.setSource(new File("C:\\work\\org.hl7.fhir\\fhir-test-cases\\r3\\ActivityDefinition-referralPrimaryCareMentalHealth.json"));
r.test();
System.out.println("Completed OK");
} catch (Exception e) {

View File

@ -17,6 +17,7 @@ import org.hl7.fhir.dstu3.context.IWorkerContext;
import org.hl7.fhir.utilities.CSFile;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.tests.BaseTestingUtilities;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@ -29,7 +30,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSyntaxException;
public class TestingUtilities {
public class TestingUtilities extends BaseTestingUtilities {
private static final boolean SHOW_DIFF = true;
static public IWorkerContext context;