From 314df430913f1e2d269a482aabc0701ee8a3be6f Mon Sep 17 00:00:00 2001 From: Diederik Muylwyk Date: Mon, 22 Jun 2020 16:52:52 -0400 Subject: [PATCH 1/3] BaseValidationSupportWrapper.expandValueSet(...) and ValidationSupportChain.expandValueSet(...) were incorrectly replacing expansion options (i.e. offset and count) with null. --- .../r5/ResourceProviderR5ValueSetTest.java | 362 +++++++++++++++++- .../support/BaseValidationSupportWrapper.java | 2 +- .../support/ValidationSupportChain.java | 2 +- 3 files changed, 363 insertions(+), 3 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java index b7dd83f9dc9..905713fe258 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java @@ -301,6 +301,122 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { } + @Test + public void testExpandByIdWithPreExpansionWithOffset() throws Exception { + myDaoConfig.setPreExpandValueSets(true); + + loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); + myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); + + Parameters respParam = ourClient + .operation() + .onInstance(myExtensionalVsId) + .named("expand") + .withParameter(Parameters.class, "offset", new IntegerType(1)) + .execute(); + ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); + ourLog.info(resp); + assertThat(resp, stringContainsInOrder( + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "")); + + } + + @Test + public void testExpandByIdWithPreExpansionWithCount() throws Exception { + myDaoConfig.setPreExpandValueSets(true); + + loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); + myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); + + Parameters respParam = ourClient + .operation() + .onInstance(myExtensionalVsId) + .named("expand") + .withParameter(Parameters.class, "count", new IntegerType(1)) + .execute(); + ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); + ourLog.info(resp); + assertThat(resp, stringContainsInOrder( + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "")); + + } + + @Test + public void testExpandByIdWithPreExpansionWithOffsetAndCount() throws Exception { + myDaoConfig.setPreExpandValueSets(true); + + loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); + myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); + + Parameters respParam = ourClient + .operation() + .onInstance(myExtensionalVsId) + .named("expand") + .withParameter(Parameters.class, "offset", new IntegerType(1)) + .andParameter("count", new IntegerType(1)) + .execute(); + ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); + ourLog.info(resp); + assertThat(resp, stringContainsInOrder( + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "")); + + } + @Test public void testExpandByIdWithFilter() throws Exception { loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); @@ -402,6 +518,125 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { } + @Test + public void testExpandByUrlWithPreExpansionWithOffset() throws Exception { + myDaoConfig.setPreExpandValueSets(true); + + loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); + myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); + + Parameters respParam = ourClient + .operation() + .onType(ValueSet.class) + .named("expand") + .withParameter(Parameters.class, "url", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2")) + .andParameter("offset", new IntegerType(1)) + .execute(); + ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); + ourLog.info(resp); + assertThat(resp, stringContainsInOrder( + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "")); + + } + + @Test + public void testExpandByUrlWithPreExpansionWithCount() throws Exception { + myDaoConfig.setPreExpandValueSets(true); + + loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); + myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); + + Parameters respParam = ourClient + .operation() + .onType(ValueSet.class) + .named("expand") + .withParameter(Parameters.class, "url", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2")) + .andParameter("count", new IntegerType(1)) + .execute(); + ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); + ourLog.info(resp); + assertThat(resp, stringContainsInOrder( + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "")); + + } + + @Test + public void testExpandByUrlWithPreExpansionWithOffsetAndCount() throws Exception { + myDaoConfig.setPreExpandValueSets(true); + + loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); + myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); + + Parameters respParam = ourClient + .operation() + .onType(ValueSet.class) + .named("expand") + .withParameter(Parameters.class, "url", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2")) + .andParameter("offset", new IntegerType(1)) + .andParameter("count", new IntegerType(1)) + .execute(); + ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); + ourLog.info(resp); + assertThat(resp, stringContainsInOrder( + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "")); + + } + @Test public void testExpandByUrlWithPreExpansionAndBogusUrl() throws Exception { myDaoConfig.setPreExpandValueSets(true); @@ -448,7 +683,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { public void testExpandByValueSetWithPreExpansion() throws IOException { myDaoConfig.setPreExpandValueSets(true); - loadAndPersistCodeSystem(HTTPVerb.POST); + loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml"); @@ -469,6 +704,131 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { } + @Test + public void testExpandByValueSetWithPreExpansionWithOffset() throws IOException { + myDaoConfig.setPreExpandValueSets(true); + + loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); + myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); + + ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml"); + + Parameters respParam = ourClient + .operation() + .onType(ValueSet.class) + .named("expand") + .withParameter(Parameters.class, "valueSet", toExpand) + .andParameter("offset", new IntegerType(1)) + .execute(); + ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); + ourLog.info(resp); + assertThat(resp, stringContainsInOrder( + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "")); + + } + + @Test + public void testExpandByValueSetWithPreExpansionWithCount() throws IOException { + myDaoConfig.setPreExpandValueSets(true); + + loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); + myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); + + ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml"); + + Parameters respParam = ourClient + .operation() + .onType(ValueSet.class) + .named("expand") + .withParameter(Parameters.class, "valueSet", toExpand) + .andParameter("count", new IntegerType(1)) + .execute(); + ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); + ourLog.info(resp); + assertThat(resp, stringContainsInOrder( + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "")); + + } + + @Test + public void testExpandByValueSetWithPreExpansionWithOffsetAndCount() throws IOException { + myDaoConfig.setPreExpandValueSets(true); + + loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); + myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); + + ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml"); + + Parameters respParam = ourClient + .operation() + .onType(ValueSet.class) + .named("expand") + .withParameter(Parameters.class, "valueSet", toExpand) + .andParameter("offset", new IntegerType(1)) + .andParameter("count", new IntegerType(1)) + .execute(); + ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); + ourLog.info(resp); + assertThat(resp, stringContainsInOrder( + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "")); + + } + @Test public void testExpandInlineVsAgainstBuiltInCs() { createLocalVsPointingAtBuiltInCodeSystem(); diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/BaseValidationSupportWrapper.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/BaseValidationSupportWrapper.java index e18e1918f14..cc04a447d10 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/BaseValidationSupportWrapper.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/BaseValidationSupportWrapper.java @@ -70,7 +70,7 @@ public class BaseValidationSupportWrapper extends BaseValidationSupport { @Override public IValidationSupport.ValueSetExpansionOutcome expandValueSet(ValidationSupportContext theValidationSupportContext, ValueSetExpansionOptions theExpansionOptions, IBaseResource theValueSetToExpand) { - return myWrap.expandValueSet(theValidationSupportContext, null, theValueSetToExpand); + return myWrap.expandValueSet(theValidationSupportContext, theExpansionOptions, theValueSetToExpand); } @Override diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/ValidationSupportChain.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/ValidationSupportChain.java index 3076d31826d..20a667e0b96 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/ValidationSupportChain.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/ValidationSupportChain.java @@ -134,7 +134,7 @@ public class ValidationSupportChain implements IValidationSupport { public ValueSetExpansionOutcome expandValueSet(ValidationSupportContext theValidationSupportContext, ValueSetExpansionOptions theExpansionOptions, IBaseResource theValueSetToExpand) { for (IValidationSupport next : myChain) { // TODO: test if code system is supported? - ValueSetExpansionOutcome expanded = next.expandValueSet(theValidationSupportContext, null, theValueSetToExpand); + ValueSetExpansionOutcome expanded = next.expandValueSet(theValidationSupportContext, theExpansionOptions, theValueSetToExpand); if (expanded != null) { return expanded; } From ced376f7ba0ecfa14003d58beb0914a474227b96 Mon Sep 17 00:00:00 2001 From: Diederik Muylwyk Date: Mon, 22 Jun 2020 17:02:08 -0400 Subject: [PATCH 2/3] Add changelog entry; fix typo. --- .../1895-fix-jpa-validation-performance-regression.yaml | 2 +- ...ix-valueset-expand-with-offset-and-count-parameters.yaml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_1_0/1933-fix-valueset-expand-with-offset-and-count-parameters.yaml diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_1_0/1895-fix-jpa-validation-performance-regression.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_1_0/1895-fix-jpa-validation-performance-regression.yaml index d7c082340b9..a6f7ebe888d 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_1_0/1895-fix-jpa-validation-performance-regression.yaml +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_1_0/1895-fix-jpa-validation-performance-regression.yaml @@ -1,5 +1,5 @@ --- type: fix issue: 1895 -title: "HAPI FHIR 5.0.0 introduced a regressin in JPA validator performance, where a number of unnecessary database lookups +title: "HAPI FHIR 5.0.0 introduced a regression in JPA validator performance, where a number of unnecessary database lookups were introduced. This has been corrected." diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_1_0/1933-fix-valueset-expand-with-offset-and-count-parameters.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_1_0/1933-fix-valueset-expand-with-offset-and-count-parameters.yaml new file mode 100644 index 00000000000..4e9d7a3aaf0 --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_1_0/1933-fix-valueset-expand-with-offset-and-count-parameters.yaml @@ -0,0 +1,6 @@ +--- +type: fix +issue: 1933 +title: "`BaseValidationSupportWrapper.expandValueSet(...)` and `ValidationSupportChain.expandValueSet(...)` were + incorrectly replacing expansion options (i.e. offset and count) with `null`, causing these parameters to be + ignored when invoking the `ValueSet$expand` operation. This has been corrected." From ce0cb8916eda93b730e0bb787f60c9b977049a7f Mon Sep 17 00:00:00 2001 From: Diederik Muylwyk Date: Mon, 22 Jun 2020 17:22:21 -0400 Subject: [PATCH 3/3] Improve tests. --- .../r5/ResourceProviderR5ValueSetTest.java | 273 +++++++----------- 1 file changed, 108 insertions(+), 165 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java index 905713fe258..58a6bf69e5d 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java @@ -318,27 +318,20 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - assertThat(resp, stringContainsInOrder( - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "")); + + assertEquals(24, expanded.getExpansion().getTotal()); + assertEquals(1, expanded.getExpansion().getOffset()); + assertEquals("offset", expanded.getExpansion().getParameter().get(0).getName()); + assertEquals(1, expanded.getExpansion().getParameter().get(0).getValueIntegerType().getValue().intValue()); + assertEquals("count", expanded.getExpansion().getParameter().get(1).getName()); + assertEquals(1000, expanded.getExpansion().getParameter().get(1).getValueIntegerType().getValue().intValue()); + assertEquals(23, expanded.getExpansion().getContains().size()); + assertEquals("http://acme.org", expanded.getExpansion().getContains().get(0).getSystem()); + assertEquals("11378-7", expanded.getExpansion().getContains().get(0).getCode()); + assertEquals("Systolic blood pressure at First encounter", expanded.getExpansion().getContains().get(0).getDisplay()); + assertEquals("http://acme.org", expanded.getExpansion().getContains().get(1).getSystem()); + assertEquals("8493-9", expanded.getExpansion().getContains().get(1).getCode()); + assertEquals("Systolic blood pressure 10 hour minimum", expanded.getExpansion().getContains().get(1).getDisplay()); } @@ -359,23 +352,17 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - assertThat(resp, stringContainsInOrder( - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "")); + + assertEquals(24, expanded.getExpansion().getTotal()); + assertEquals(0, expanded.getExpansion().getOffset()); + assertEquals("offset", expanded.getExpansion().getParameter().get(0).getName()); + assertEquals(0, expanded.getExpansion().getParameter().get(0).getValueIntegerType().getValue().intValue()); + assertEquals("count", expanded.getExpansion().getParameter().get(1).getName()); + assertEquals(1, expanded.getExpansion().getParameter().get(1).getValueIntegerType().getValue().intValue()); + assertEquals(1, expanded.getExpansion().getContains().size()); + assertEquals("http://acme.org", expanded.getExpansion().getContainsFirstRep().getSystem()); + assertEquals("8450-9", expanded.getExpansion().getContainsFirstRep().getCode()); + assertEquals("Systolic blood pressure--expiration", expanded.getExpansion().getContainsFirstRep().getDisplay()); } @@ -397,23 +384,17 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - assertThat(resp, stringContainsInOrder( - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "")); + + assertEquals(24, expanded.getExpansion().getTotal()); + assertEquals(1, expanded.getExpansion().getOffset()); + assertEquals("offset", expanded.getExpansion().getParameter().get(0).getName()); + assertEquals(1, expanded.getExpansion().getParameter().get(0).getValueIntegerType().getValue().intValue()); + assertEquals("count", expanded.getExpansion().getParameter().get(1).getName()); + assertEquals(1, expanded.getExpansion().getParameter().get(1).getValueIntegerType().getValue().intValue()); + assertEquals(1, expanded.getExpansion().getContains().size()); + assertEquals("http://acme.org", expanded.getExpansion().getContainsFirstRep().getSystem()); + assertEquals("11378-7", expanded.getExpansion().getContainsFirstRep().getCode()); + assertEquals("Systolic blood pressure at First encounter", expanded.getExpansion().getContainsFirstRep().getDisplay()); } @@ -536,27 +517,20 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - assertThat(resp, stringContainsInOrder( - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "")); + + assertEquals(24, expanded.getExpansion().getTotal()); + assertEquals(1, expanded.getExpansion().getOffset()); + assertEquals("offset", expanded.getExpansion().getParameter().get(0).getName()); + assertEquals(1, expanded.getExpansion().getParameter().get(0).getValueIntegerType().getValue().intValue()); + assertEquals("count", expanded.getExpansion().getParameter().get(1).getName()); + assertEquals(1000, expanded.getExpansion().getParameter().get(1).getValueIntegerType().getValue().intValue()); + assertEquals(23, expanded.getExpansion().getContains().size()); + assertEquals("http://acme.org", expanded.getExpansion().getContains().get(0).getSystem()); + assertEquals("11378-7", expanded.getExpansion().getContains().get(0).getCode()); + assertEquals("Systolic blood pressure at First encounter", expanded.getExpansion().getContains().get(0).getDisplay()); + assertEquals("http://acme.org", expanded.getExpansion().getContains().get(1).getSystem()); + assertEquals("8493-9", expanded.getExpansion().getContains().get(1).getCode()); + assertEquals("Systolic blood pressure 10 hour minimum", expanded.getExpansion().getContains().get(1).getDisplay()); } @@ -578,23 +552,17 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - assertThat(resp, stringContainsInOrder( - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "")); + + assertEquals(24, expanded.getExpansion().getTotal()); + assertEquals(0, expanded.getExpansion().getOffset()); + assertEquals("offset", expanded.getExpansion().getParameter().get(0).getName()); + assertEquals(0, expanded.getExpansion().getParameter().get(0).getValueIntegerType().getValue().intValue()); + assertEquals("count", expanded.getExpansion().getParameter().get(1).getName()); + assertEquals(1, expanded.getExpansion().getParameter().get(1).getValueIntegerType().getValue().intValue()); + assertEquals(1, expanded.getExpansion().getContains().size()); + assertEquals("http://acme.org", expanded.getExpansion().getContainsFirstRep().getSystem()); + assertEquals("8450-9", expanded.getExpansion().getContainsFirstRep().getCode()); + assertEquals("Systolic blood pressure--expiration", expanded.getExpansion().getContainsFirstRep().getDisplay()); } @@ -617,23 +585,17 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - assertThat(resp, stringContainsInOrder( - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "")); + + assertEquals(24, expanded.getExpansion().getTotal()); + assertEquals(1, expanded.getExpansion().getOffset()); + assertEquals("offset", expanded.getExpansion().getParameter().get(0).getName()); + assertEquals(1, expanded.getExpansion().getParameter().get(0).getValueIntegerType().getValue().intValue()); + assertEquals("count", expanded.getExpansion().getParameter().get(1).getName()); + assertEquals(1, expanded.getExpansion().getParameter().get(1).getValueIntegerType().getValue().intValue()); + assertEquals(1, expanded.getExpansion().getContains().size()); + assertEquals("http://acme.org", expanded.getExpansion().getContainsFirstRep().getSystem()); + assertEquals("11378-7", expanded.getExpansion().getContainsFirstRep().getCode()); + assertEquals("Systolic blood pressure at First encounter", expanded.getExpansion().getContainsFirstRep().getDisplay()); } @@ -724,27 +686,20 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - assertThat(resp, stringContainsInOrder( - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "")); + + assertEquals(24, expanded.getExpansion().getTotal()); + assertEquals(1, expanded.getExpansion().getOffset()); + assertEquals("offset", expanded.getExpansion().getParameter().get(0).getName()); + assertEquals(1, expanded.getExpansion().getParameter().get(0).getValueIntegerType().getValue().intValue()); + assertEquals("count", expanded.getExpansion().getParameter().get(1).getName()); + assertEquals(1000, expanded.getExpansion().getParameter().get(1).getValueIntegerType().getValue().intValue()); + assertEquals(23, expanded.getExpansion().getContains().size()); + assertEquals("http://acme.org", expanded.getExpansion().getContains().get(0).getSystem()); + assertEquals("11378-7", expanded.getExpansion().getContains().get(0).getCode()); + assertEquals("Systolic blood pressure at First encounter", expanded.getExpansion().getContains().get(0).getDisplay()); + assertEquals("http://acme.org", expanded.getExpansion().getContains().get(1).getSystem()); + assertEquals("8493-9", expanded.getExpansion().getContains().get(1).getCode()); + assertEquals("Systolic blood pressure 10 hour minimum", expanded.getExpansion().getContains().get(1).getDisplay()); } @@ -768,23 +723,17 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - assertThat(resp, stringContainsInOrder( - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "")); + + assertEquals(24, expanded.getExpansion().getTotal()); + assertEquals(0, expanded.getExpansion().getOffset()); + assertEquals("offset", expanded.getExpansion().getParameter().get(0).getName()); + assertEquals(0, expanded.getExpansion().getParameter().get(0).getValueIntegerType().getValue().intValue()); + assertEquals("count", expanded.getExpansion().getParameter().get(1).getName()); + assertEquals(1, expanded.getExpansion().getParameter().get(1).getValueIntegerType().getValue().intValue()); + assertEquals(1, expanded.getExpansion().getContains().size()); + assertEquals("http://acme.org", expanded.getExpansion().getContainsFirstRep().getSystem()); + assertEquals("8450-9", expanded.getExpansion().getContainsFirstRep().getCode()); + assertEquals("Systolic blood pressure--expiration", expanded.getExpansion().getContainsFirstRep().getDisplay()); } @@ -809,23 +758,17 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - assertThat(resp, stringContainsInOrder( - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "")); + + assertEquals(24, expanded.getExpansion().getTotal()); + assertEquals(1, expanded.getExpansion().getOffset()); + assertEquals("offset", expanded.getExpansion().getParameter().get(0).getName()); + assertEquals(1, expanded.getExpansion().getParameter().get(0).getValueIntegerType().getValue().intValue()); + assertEquals("count", expanded.getExpansion().getParameter().get(1).getName()); + assertEquals(1, expanded.getExpansion().getParameter().get(1).getValueIntegerType().getValue().intValue()); + assertEquals(1, expanded.getExpansion().getContains().size()); + assertEquals("http://acme.org", expanded.getExpansion().getContainsFirstRep().getSystem()); + assertEquals("11378-7", expanded.getExpansion().getContainsFirstRep().getCode()); + assertEquals("Systolic blood pressure at First encounter", expanded.getExpansion().getContainsFirstRep().getDisplay()); }