Fix unit tests
This commit is contained in:
parent
98e0753b93
commit
6b9f8ec487
|
@ -95,12 +95,13 @@ public class ResourceReferenceInfo {
|
|||
int colonIndex = theInclude.getValue().indexOf(':');
|
||||
if (colonIndex != -1) {
|
||||
// DSTU2+ style
|
||||
String resourceName = theInclude.getValue().substring(0, colonIndex);
|
||||
String paramName = theInclude.getValue().substring(colonIndex + 1);
|
||||
RuntimeResourceDefinition resourceDef = myContext.getResourceDefinition(myOwningResource);
|
||||
RuntimeResourceDefinition resourceDef = myContext.getResourceDefinition(resourceName);
|
||||
if (resourceDef != null) {
|
||||
RuntimeSearchParam searchParamDef = resourceDef.getSearchParam(paramName);
|
||||
if (searchParamDef!=null) {
|
||||
if (searchParamDef.getPathsSplit().contains(resourceDef.getName() + "." + myName)) {
|
||||
if (searchParamDef.getPathsSplit().contains(myOwningResource + "." + myName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@ import ca.uhn.fhir.rest.server.BundleInclusionRule;
|
|||
import ca.uhn.fhir.util.TestUtil;
|
||||
|
||||
public class Dstu2BundleFactoryTest {
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(Dstu2BundleFactoryTest.class);
|
||||
|
||||
private static FhirContext ourCtx;
|
||||
private List<IBaseResource> myResourceList;
|
||||
private Dstu2BundleFactory myBundleFactory;
|
||||
|
@ -42,7 +44,6 @@ public class Dstu2BundleFactoryTest {
|
|||
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||
}
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
// DiagnosticReport
|
||||
|
@ -120,6 +121,8 @@ public class Dstu2BundleFactoryTest {
|
|||
public void whenAChainedResourceIsIncludedAndItsParentIsAlsoIncluded_bundle_shouldContainTheChainedResource() throws Exception {
|
||||
Bundle bundle = makeBundle(BundleInclusionRule.BASED_ON_INCLUDES, includes(DiagnosticReport.INCLUDE_RESULT.getValue(), Observation.INCLUDE_SPECIMEN.getValue()));
|
||||
|
||||
ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(bundle));
|
||||
|
||||
assertEquals(3, bundle.getEntry().size());
|
||||
assertEquals(1, numberOfEntriesOfType(bundle, DiagnosticReport.class));
|
||||
assertEquals(1, numberOfEntriesOfType(bundle, Observation.class));
|
||||
|
|
Loading…
Reference in New Issue