Add test case for Json resource parsing
This commit is contained in:
parent
1af6268fa8
commit
4aa8e08681
|
@ -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"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -41,7 +41,7 @@ public class SingleTest {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
ResourceTest r = new ResourceTest();
|
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();
|
r.test();
|
||||||
System.out.println("Completed OK");
|
System.out.println("Completed OK");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -17,6 +17,7 @@ import org.hl7.fhir.dstu3.context.IWorkerContext;
|
||||||
import org.hl7.fhir.utilities.CSFile;
|
import org.hl7.fhir.utilities.CSFile;
|
||||||
import org.hl7.fhir.utilities.TextFile;
|
import org.hl7.fhir.utilities.TextFile;
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
import org.hl7.fhir.utilities.Utilities;
|
||||||
|
import org.hl7.fhir.utilities.tests.BaseTestingUtilities;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.NamedNodeMap;
|
import org.w3c.dom.NamedNodeMap;
|
||||||
|
@ -29,7 +30,7 @@ import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonPrimitive;
|
import com.google.gson.JsonPrimitive;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
|
||||||
public class TestingUtilities {
|
public class TestingUtilities extends BaseTestingUtilities {
|
||||||
private static final boolean SHOW_DIFF = true;
|
private static final boolean SHOW_DIFF = true;
|
||||||
|
|
||||||
static public IWorkerContext context;
|
static public IWorkerContext context;
|
||||||
|
|
Loading…
Reference in New Issue