Merge pull request #298 from hapifhir/gg-v3-parser-test
Add test case for Json resource parsing
This commit is contained in:
commit
7f79342447
|
@ -116,6 +116,12 @@
|
|||
<version>${junit_jupiter_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hl7.fhir.testcases</groupId>
|
||||
<artifactId>fhir-test-cases</artifactId>
|
||||
<version>${validator_test_case_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -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) {
|
||||
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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -5,10 +5,9 @@ import org.hl7.fhir.utilities.CSFile;
|
|||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BaseTestingUtilities {
|
||||
|
||||
|
@ -88,6 +87,4 @@ public class BaseTestingUtilities {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue