Fix some test failures

This commit is contained in:
James Agnew 2018-08-12 12:12:09 -04:00
parent ea70683604
commit 0a1ae541e6
3 changed files with 103 additions and 117 deletions

View File

@ -16,7 +16,6 @@ import ca.uhn.fhir.rest.server.exceptions.*;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails;
import ca.uhn.fhir.util.TestUtil;
import org.apache.commons.io.IOUtils;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IIdType;
@ -44,7 +43,6 @@ import java.util.Set;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.matches;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@ -53,6 +51,11 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirSystemDaoR4Test.class);
@AfterClass
public static void afterClassClearContext() {
TestUtil.clearAllStaticFieldsForUnitTest();
}
@After
public void after() {
myDaoConfig.setAllowInlineMatchUrlReferences(false);
@ -190,7 +193,6 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
}
@Test
public void testBatchCreateWithBadRead() {
Bundle request = new Bundle();
@ -1523,26 +1525,6 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
}
}
@Test
public void testTransactionDoesNotAllowDanglingTemporaryIds() throws Exception {
String input = IOUtils.toString(getClass().getResourceAsStream("/cdr-bundle.json"), StandardCharsets.UTF_8);
Bundle bundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, input);
BundleEntryComponent entry = bundle.addEntry();
Patient p = new Patient();
p.getManagingOrganization().setReference("urn:uuid:30ce60cf-f7cb-4196-961f-cadafa8b7ff5");
entry.setResource(p);
entry.getRequest().setMethod(HTTPVerb.POST);
entry.getRequest().setUrl("Patient");
try {
mySystemDao.transaction(mySrd, bundle);
fail();
} catch (InvalidRequestException e) {
assertEquals("Unable to satisfy placeholder ID: urn:uuid:30ce60cf-f7cb-4196-961f-cadafa8b7ff5", e.getMessage());
}
}
@Test
public void testTransactionDoesNotLeavePlaceholderIds() {
String input;
@ -1627,7 +1609,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
map.add(Patient.SP_IDENTIFIER, new TokenParam("foo", "bar"));
search = myPatientDao.search(map);
assertThat(toUnqualifiedVersionlessIdValues(search), contains(createdPatientId.toUnqualifiedVersionless().getValue()));
pat = (Patient) search.getResources(0,1).get(0);
pat = (Patient) search.getResources(0, 1).get(0);
assertEquals("foo", pat.getIdentifierFirstRep().getSystem());
// Observation
map = new SearchParameterMap();
@ -1635,7 +1617,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
map.add(Observation.SP_IDENTIFIER, new TokenParam("foo", "dog"));
search = myObservationDao.search(map);
assertThat(toUnqualifiedVersionlessIdValues(search), contains(createdObservationId.toUnqualifiedVersionless().getValue()));
obs = (Observation) search.getResources(0,1).get(0);
obs = (Observation) search.getResources(0, 1).get(0);
assertEquals("foo", obs.getIdentifierFirstRep().getSystem());
assertEquals(createdPatientId.toUnqualifiedVersionless().getValue(), obs.getSubject().getReference());
@ -1692,7 +1674,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
map.add(Patient.SP_IDENTIFIER, new TokenParam("foo", "bar"));
search = myPatientDao.search(map);
assertThat(toUnqualifiedVersionlessIdValues(search), contains(createdPatientId.toUnqualifiedVersionless().getValue()));
pat = (Patient) search.getResources(0,1).get(0);
pat = (Patient) search.getResources(0, 1).get(0);
assertEquals("foo", pat.getIdentifierFirstRep().getSystem());
// Observation
map = new SearchParameterMap();
@ -1700,7 +1682,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
map.add(Observation.SP_IDENTIFIER, new TokenParam("foo", "dog"));
search = myObservationDao.search(map);
assertThat(toUnqualifiedVersionlessIdValues(search), contains(createdObservationId.toUnqualifiedVersionless().getValue()));
obs = (Observation) search.getResources(0,1).get(0);
obs = (Observation) search.getResources(0, 1).get(0);
assertEquals("foo", obs.getIdentifierFirstRep().getSystem());
assertEquals(createdPatientId.toUnqualifiedVersionless().getValue(), obs.getSubject().getReference());
@ -1758,7 +1740,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
map.add(Patient.SP_IDENTIFIER, new TokenParam("foo", "bar"));
search = myPatientDao.search(map);
assertThat(toUnqualifiedVersionlessIdValues(search), contains(createdPatientId.toUnqualifiedVersionless().getValue()));
pat = (Patient) search.getResources(0,1).get(0);
pat = (Patient) search.getResources(0, 1).get(0);
assertEquals("foo", pat.getIdentifierFirstRep().getSystem());
// Observation
map = new SearchParameterMap();
@ -1766,7 +1748,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
map.add(Observation.SP_IDENTIFIER, new TokenParam("foo", "dog"));
search = myObservationDao.search(map);
assertThat(toUnqualifiedVersionlessIdValues(search), contains(createdObservationId.toUnqualifiedVersionless().getValue()));
obs = (Observation) search.getResources(0,1).get(0);
obs = (Observation) search.getResources(0, 1).get(0);
assertEquals("foo", obs.getIdentifierFirstRep().getSystem());
assertEquals(createdPatientId.toUnqualifiedVersionless().getValue(), obs.getSubject().getReference());
assertEquals(ObservationStatus.FINAL, obs.getStatus());
@ -2135,7 +2117,6 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
assertNull(nextEntry.getResource());
}
@Test
public void testTransactionWithUnknownTemnporaryIdReference() {
String methodName = "testTransactionWithUnknownTemnporaryIdReference";
@ -2155,7 +2136,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
mySystemDao.transaction(mySrd, request);
fail();
} catch (InvalidRequestException e) {
assertThat(e.getMessage(), Matchers.matchesPattern("Unable to satisfy placeholder ID urn:uuid:[0-9a-z-]+ found in element named 'managingOrganization' within resource of type: Patient"));
assertThat(e.getMessage(), Matchers.matchesPattern("Unable to satisfy placeholder ID urn:uuid:[0-9a-z-]+ found in element named 'managingOrganization' within resource of type: Patient"));
}
}
@ -3074,44 +3055,6 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
assertEquals(1, found.size().intValue());
}
@Test
public void testTransactionWithRelativeOidIds() {
Bundle res = new Bundle();
res.setType(BundleType.TRANSACTION);
Patient p1 = new Patient();
p1.setId("urn:oid:0.1.2.3");
p1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds01");
res.addEntry().setResource(p1).getRequest().setMethod(HTTPVerb.POST).setUrl("Patient");
Observation o1 = new Observation();
o1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds02");
o1.setSubject(new Reference("urn:oid:0.1.2.3"));
res.addEntry().setResource(o1).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");
Observation o2 = new Observation();
o2.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds03");
o2.setSubject(new Reference("urn:oid:0.1.2.3"));
res.addEntry().setResource(o2).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");
Bundle resp = mySystemDao.transaction(mySrd, res);
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(resp));
assertEquals(BundleType.TRANSACTIONRESPONSE, resp.getTypeElement().getValue());
assertEquals(3, resp.getEntry().size());
assertTrue(resp.getEntry().get(0).getResponse().getLocation(), new IdType(resp.getEntry().get(0).getResponse().getLocation()).getIdPart().matches("^[0-9]+$"));
assertTrue(resp.getEntry().get(1).getResponse().getLocation(), new IdType(resp.getEntry().get(1).getResponse().getLocation()).getIdPart().matches("^[0-9]+$"));
assertTrue(resp.getEntry().get(2).getResponse().getLocation(), new IdType(resp.getEntry().get(2).getResponse().getLocation()).getIdPart().matches("^[0-9]+$"));
o1 = myObservationDao.read(new IdType(resp.getEntry().get(1).getResponse().getLocation()), mySrd);
o2 = myObservationDao.read(new IdType(resp.getEntry().get(2).getResponse().getLocation()), mySrd);
assertThat(o1.getSubject().getReferenceElement().getValue(), endsWith("Patient/" + p1.getIdElement().getIdPart()));
assertThat(o2.getSubject().getReferenceElement().getValue(), endsWith("Patient/" + p1.getIdElement().getIdPart()));
}
//
//
// /**
@ -3214,6 +3157,44 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
//
// }
@Test
public void testTransactionWithRelativeOidIds() {
Bundle res = new Bundle();
res.setType(BundleType.TRANSACTION);
Patient p1 = new Patient();
p1.setId("urn:oid:0.1.2.3");
p1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds01");
res.addEntry().setResource(p1).getRequest().setMethod(HTTPVerb.POST).setUrl("Patient");
Observation o1 = new Observation();
o1.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds02");
o1.setSubject(new Reference("urn:oid:0.1.2.3"));
res.addEntry().setResource(o1).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");
Observation o2 = new Observation();
o2.addIdentifier().setSystem("system").setValue("testTransactionWithRelativeOidIds03");
o2.setSubject(new Reference("urn:oid:0.1.2.3"));
res.addEntry().setResource(o2).getRequest().setMethod(HTTPVerb.POST).setUrl("Observation");
Bundle resp = mySystemDao.transaction(mySrd, res);
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(resp));
assertEquals(BundleType.TRANSACTIONRESPONSE, resp.getTypeElement().getValue());
assertEquals(3, resp.getEntry().size());
assertTrue(resp.getEntry().get(0).getResponse().getLocation(), new IdType(resp.getEntry().get(0).getResponse().getLocation()).getIdPart().matches("^[0-9]+$"));
assertTrue(resp.getEntry().get(1).getResponse().getLocation(), new IdType(resp.getEntry().get(1).getResponse().getLocation()).getIdPart().matches("^[0-9]+$"));
assertTrue(resp.getEntry().get(2).getResponse().getLocation(), new IdType(resp.getEntry().get(2).getResponse().getLocation()).getIdPart().matches("^[0-9]+$"));
o1 = myObservationDao.read(new IdType(resp.getEntry().get(1).getResponse().getLocation()), mySrd);
o2 = myObservationDao.read(new IdType(resp.getEntry().get(2).getResponse().getLocation()), mySrd);
assertThat(o1.getSubject().getReferenceElement().getValue(), endsWith("Patient/" + p1.getIdElement().getIdPart()));
assertThat(o2.getSubject().getReferenceElement().getValue(), endsWith("Patient/" + p1.getIdElement().getIdPart()));
}
/**
* This is not the correct way to do it, but we'll allow it to be lenient
*/
@ -3257,7 +3238,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
@Test
public void testTransactionWithReplacement() {
byte[] bytes = new byte[] {0, 1, 2, 3, 4};
byte[] bytes = new byte[]{0, 1, 2, 3, 4};
Binary binary = new Binary();
binary.setId(IdType.newRandomUuid());
@ -3426,9 +3407,4 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
}
@AfterClass
public static void afterClassClearContext() {
TestUtil.clearAllStaticFieldsForUnitTest();
}
}

View File

@ -988,9 +988,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(1, getNumberOfParametersByName(respParams, "match"));
param = getParametersByName(respParams, "match").get(0);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
ParametersParameterComponent part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("narrower", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
Coding coding = (Coding) part.getValue();
assertEquals("78901", coding.getCode());
@ -1069,9 +1069,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(2, getNumberOfParametersByName(respParams, "match"));
param = getParametersByName(respParams, "match").get(0);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
ParametersParameterComponent part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("equal", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
Coding coding = (Coding) part.getValue();
assertEquals("12345", coding.getCode());
@ -1083,9 +1083,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(CM_URL, ((UriType) part.getValue()).getValueAsString());
param = getParametersByName(respParams, "match").get(1);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("narrower", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
coding = (Coding) part.getValue();
assertEquals("78901", coding.getCode());
@ -1135,9 +1135,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(2, getNumberOfParametersByName(respParams, "match"));
param = getParametersByName(respParams, "match").get(0);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
ParametersParameterComponent part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("equal", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
Coding coding = (Coding) part.getValue();
assertEquals("12345", coding.getCode());
@ -1149,9 +1149,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(CM_URL, ((UriType) part.getValue()).getValueAsString());
param = getParametersByName(respParams, "match").get(1);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("narrower", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
coding = (Coding) part.getValue();
assertEquals("78901", coding.getCode());
@ -1205,9 +1205,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(4, getNumberOfParametersByName(respParams, "match"));
param = getParametersByName(respParams, "match").get(0);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
ParametersParameterComponent part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("equal", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
Coding coding = (Coding) part.getValue();
assertEquals("12345", coding.getCode());
@ -1219,9 +1219,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(CM_URL, ((UriType) part.getValue()).getValueAsString());
param = getParametersByName(respParams, "match").get(1);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("narrower", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
coding = (Coding) part.getValue();
assertEquals("78901", coding.getCode());
@ -1247,9 +1247,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(CM_URL, ((UriType) part.getValue()).getValueAsString());
param = getParametersByName(respParams, "match").get(3);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("equal", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
coding = (Coding) part.getValue();
assertEquals("12345", coding.getCode());
@ -1298,9 +1298,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(2, getNumberOfParametersByName(respParams, "match"));
param = getParametersByName(respParams, "match").get(0);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
ParametersParameterComponent part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("equal", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
Coding coding = (Coding) part.getValue();
assertEquals("12345", coding.getCode());
@ -1312,9 +1312,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(CM_URL, ((UriType) part.getValue()).getValueAsString());
param = getParametersByName(respParams, "match").get(1);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("narrower", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
coding = (Coding) part.getValue();
assertEquals("78901", coding.getCode());
@ -1365,9 +1365,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(2, getNumberOfParametersByName(respParams, "match"));
param = getParametersByName(respParams, "match").get(0);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
ParametersParameterComponent part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("equal", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
Coding coding = (Coding) part.getValue();
assertEquals("12345", coding.getCode());
@ -1379,9 +1379,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(CM_URL, ((UriType) part.getValue()).getValueAsString());
param = getParametersByName(respParams, "match").get(1);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("narrower", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
coding = (Coding) part.getValue();
assertEquals("78901", coding.getCode());
@ -1432,9 +1432,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(1, getNumberOfParametersByName(respParams, "match"));
param = getParametersByName(respParams, "match").get(0);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
ParametersParameterComponent part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("equal", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
Coding coding = (Coding) part.getValue();
assertEquals("12345", coding.getCode());
@ -1485,9 +1485,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(1, getNumberOfParametersByName(respParams, "match"));
param = getParametersByName(respParams, "match").get(0);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
ParametersParameterComponent part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("narrower", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
Coding coding = (Coding) part.getValue();
assertEquals("78901", coding.getCode());
@ -1536,9 +1536,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(2, getNumberOfParametersByName(respParams, "match"));
param = getParametersByName(respParams, "match").get(0);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
ParametersParameterComponent part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("equal", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
Coding coding = (Coding) part.getValue();
assertEquals("12345", coding.getCode());
@ -1550,9 +1550,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(CM_URL, ((UriType) part.getValue()).getValueAsString());
param = getParametersByName(respParams, "match").get(1);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("narrower", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
coding = (Coding) part.getValue();
assertEquals("78901", coding.getCode());
@ -1601,9 +1601,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(2, getNumberOfParametersByName(respParams, "match"));
param = getParametersByName(respParams, "match").get(0);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
ParametersParameterComponent part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("equal", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
Coding coding = (Coding) part.getValue();
assertEquals("12345", coding.getCode());
@ -1615,9 +1615,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(CM_URL, ((UriType) part.getValue()).getValueAsString());
param = getParametersByName(respParams, "match").get(1);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("narrower", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
coding = (Coding) part.getValue();
assertEquals("78901", coding.getCode());
@ -1659,9 +1659,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(2, getNumberOfParametersByName(respParams, "match"));
param = getParametersByName(respParams, "match").get(0);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
ParametersParameterComponent part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("equal", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
Coding coding = (Coding) part.getValue();
assertEquals("12345", coding.getCode());
@ -1673,9 +1673,9 @@ public class ResourceProviderR4ConceptMapTest extends BaseResourceProviderR4Test
assertEquals(CM_URL, ((UriType) part.getValue()).getValueAsString());
param = getParametersByName(respParams, "match").get(1);
assertEquals(2, param.getPart().size());
assertEquals(3, param.getPart().size());
part = getPartByName(param, "equivalence");
assertFalse(part.hasValue());
assertEquals("narrower", ((CodeType)part.getValue()).getCode());
part = getPartByName(param, "concept");
coding = (Coding) part.getValue();
assertEquals("78901", coding.getCode());

View File

@ -190,12 +190,22 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
assertEquals("Version 1", element.getSystemVersion());
assertEquals(VS_URL, element.getValueSet());
assertEquals(CM_URL, element.getConceptMapUrl());
assertEquals(1, element.getConceptMapGroupElementTargets().size());
assertEquals(2, element.getConceptMapGroupElementTargets().size());
target = element.getConceptMapGroupElementTargets().get(0);
ourLog.info("ConceptMap.group(0).element(1).target(0):\n" + target.toString());
assertEquals("45678", target.getCode());
assertEquals("Target Code 45678", target.getDisplay());
assertEquals(CS_URL_2, target.getSystem());
assertEquals("Version 2", target.getSystemVersion());
assertEquals(ConceptMapEquivalence.WIDER, target.getEquivalence());
assertEquals(VS_URL_2, target.getValueSet());
assertEquals(CM_URL, target.getConceptMapUrl());
// We had deliberately added a duplicate, and here it is...
target = element.getConceptMapGroupElementTargets().get(1);
ourLog.info("ConceptMap.group(0).element(1).target(1):\n" + target.toString());
assertEquals("45678", target.getCode());
assertEquals("Target Code 45678", target.getDisplay());
assertEquals(CS_URL_2, target.getSystem());