From c57ec9912ad0bef865bf544baf8f22f1c92a3b08 Mon Sep 17 00:00:00 2001 From: "de Beaubien, Bill" Date: Tue, 1 Sep 2015 09:21:51 -0400 Subject: [PATCH] Added ignored test demonstrating dstu1 json bundle parsing issue --- .../ca/uhn/fhir/parser/JsonParserTest.java | 91 +++++++++++++++---- 1 file changed, 72 insertions(+), 19 deletions(-) diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java index bd58fec7e6e..4ef332b6908 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java @@ -30,6 +30,7 @@ import org.hamcrest.text.StringContainsInOrder; import org.hl7.fhir.instance.model.api.IBaseResource; import org.junit.Before; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import ca.uhn.fhir.context.ConfigurationException; @@ -884,25 +885,25 @@ public class JsonParserTest { String enc = ourCtx.newJsonParser().encodeResourceToString(patient); ourLog.info(enc); //@formatter:off - assertThat(enc, containsString(("{\n" + - " \"resourceType\":\"Patient\",\n" + - " \"name\":[\n" + - " {\n" + - " \"family\":[\n" + - " \"Shmoe\"\n" + - " ],\n" + - " \"_family\":[\n" + - " {\n" + - " \"extension\":[\n" + - " {\n" + - " \"url\":\"http://examples.com#givenext\",\n" + - " \"valueString\":\"Hello\"\n" + - " }\n" + - " ]\n" + - " }\n" + - " ]\n" + - " }\n" + - " ]\n" + + assertThat(enc, containsString(("{\n" + + " \"resourceType\":\"Patient\",\n" + + " \"name\":[\n" + + " {\n" + + " \"family\":[\n" + + " \"Shmoe\"\n" + + " ],\n" + + " \"_family\":[\n" + + " {\n" + + " \"extension\":[\n" + + " {\n" + + " \"url\":\"http://examples.com#givenext\",\n" + + " \"valueString\":\"Hello\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + "}").replace("\n", "").replaceAll(" +", ""))); //@formatter:on @@ -1059,6 +1060,58 @@ public class JsonParserTest { } + @Ignore + @Test + public void testTotalResultsInJsonBundle() { + String json = + "{" + + " \"resourceType\" : \"Bundle\"," + + " \"id\" : \"cb095f55-afb0-41e8-89d5-155259b2a032\"," + + " \"updated\" : \"2015-09-01T08:52:02.793-04:00\"," + + " \"link\" : [{" + + " \"rel\" : \"self\"," + + " \"href\" : \"http://fhirtest.uhn.ca/baseDstu1/Patient/_search?family=Perez\"" + + " }, {" + + " \"rel\" : \"next\"," + + " \"href\" : \"http://fhirtest.uhn.ca/baseDstu1?_getpages=c1db1094-cc46-49f1-ae69-4763ba52458b&_getpagesoffset=10&_count=10&_format=json&_pretty=true\"" + + " }, {" + + " \"rel\" : \"fhir-base\"," + + " \"href\" : \"http://fhirtest.uhn.ca/baseDstu1\"" + + " }" + + " ]," + + " \"totalResults\" : \"1\"," + + " \"entry\" : [{" + + " \"title\" : \"GONZALO PEREZ (DNI20425239)\"," + + " \"id\" : \"http://fhirtest.uhn.ca/baseDstu1/Patient/34834\"," + + " \"link\" : [{" + + " \"rel\" : \"self\"," + + " \"href\" : \"http://fhirtest.uhn.ca/baseDstu1/Patient/34834/_history/1\"" + + " }" + + " ]," + + " \"updated\" : \"2015-06-10T10:39:38.712-04:00\"," + + " \"published\" : \"2015-06-10T10:39:38.665-04:00\"," + + " \"content\" : {" + + " \"resourceType\" : \"Patient\"," + + " \"name\" : [{" + + " \"family\" : [" + + " \"PEREZ\"" + + " ]," + + " \"given\" : [" + + " \"GONZALO\"" + + " ]" + + " }" + + " ]" + + " }" + + " }" + + " ]" + + "}"; + + IParser jsonParser = ourCtx.newJsonParser(); + Bundle bundle = jsonParser.parseBundle(json); + System.out.println("Done"); + + } + @Test public void testParseBundleDeletedEntry() {