Merge branch 'gg_20201105-remove-person-references' of github.com:jamesagnew/hapi-fhir into gg_20201105-remove-person-references

This commit is contained in:
Tadgh 2020-11-16 19:42:16 -05:00
commit d15ce0db08
1 changed files with 23 additions and 6 deletions

View File

@ -1,17 +1,22 @@
package ca.uhn.fhir.empi.svc;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.empi.BaseR4Test;
import ca.uhn.fhir.empi.model.CanonicalEID;
import ca.uhn.fhir.empi.rules.config.EmpiRuleValidator;
import ca.uhn.fhir.empi.rules.config.EmpiSettings;
import ca.uhn.fhir.empi.rules.json.EmpiRulesJson;
import ca.uhn.fhir.empi.util.EIDHelper;
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
import org.hl7.fhir.r4.model.Identifier;
import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import static ca.uhn.fhir.empi.api.EmpiConstants.HAPI_ENTERPRISE_IDENTIFIER_SYSTEM;
@ -19,6 +24,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.when;
public class EIDHelperR4Test extends BaseR4Test {
@ -26,9 +32,12 @@ public class EIDHelperR4Test extends BaseR4Test {
private static final FhirContext ourFhirContext = FhirContext.forR4();
private static final String EXTERNAL_ID_SYSTEM_FOR_TEST = "http://testsystem.io/naming-system/empi";
private static final EmpiRulesJson ourRules = new EmpiRulesJson() {{
private static final EmpiRulesJson ourRules = new EmpiRulesJson() {
{
setEnterpriseEIDSystem(EXTERNAL_ID_SYSTEM_FOR_TEST);
}};
setMdmTypes(Arrays.asList(new String[] {"Patient"}));
}
};
private EmpiSettings myEmpiSettings;
@ -36,9 +45,17 @@ public class EIDHelperR4Test extends BaseR4Test {
@BeforeEach
public void before() {
myEmpiSettings = new EmpiSettings(new EmpiRuleValidator(ourFhirContext, mySearchParamRetriever)) {{
when(mySearchParamRetriever.getActiveSearchParam("Patient", "identifier"))
.thenReturn(new RuntimeSearchParam(
"identifier", "Description", "identifier", RestSearchParameterTypeEnum.STRING,
new HashSet<>(), new HashSet<>(), RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE
));
myEmpiSettings = new EmpiSettings(new EmpiRuleValidator(ourFhirContext, mySearchParamRetriever)) {
{
setEmpiRules(ourRules);
}};
}
};
myEidHelper = new EIDHelper(ourFhirContext, myEmpiSettings);
}