Updated mocks for EID helper test
This commit is contained in:
parent
406bbafafe
commit
4d9414597b
|
@ -1,17 +1,22 @@
|
||||||
package ca.uhn.fhir.empi.svc;
|
package ca.uhn.fhir.empi.svc;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
|
import ca.uhn.fhir.context.RuntimeSearchParam;
|
||||||
import ca.uhn.fhir.empi.BaseR4Test;
|
import ca.uhn.fhir.empi.BaseR4Test;
|
||||||
import ca.uhn.fhir.empi.model.CanonicalEID;
|
import ca.uhn.fhir.empi.model.CanonicalEID;
|
||||||
import ca.uhn.fhir.empi.rules.config.EmpiRuleValidator;
|
import ca.uhn.fhir.empi.rules.config.EmpiRuleValidator;
|
||||||
import ca.uhn.fhir.empi.rules.config.EmpiSettings;
|
import ca.uhn.fhir.empi.rules.config.EmpiSettings;
|
||||||
import ca.uhn.fhir.empi.rules.json.EmpiRulesJson;
|
import ca.uhn.fhir.empi.rules.json.EmpiRulesJson;
|
||||||
import ca.uhn.fhir.empi.util.EIDHelper;
|
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.Identifier;
|
||||||
import org.hl7.fhir.r4.model.Patient;
|
import org.hl7.fhir.r4.model.Patient;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static ca.uhn.fhir.empi.api.EmpiConstants.HAPI_ENTERPRISE_IDENTIFIER_SYSTEM;
|
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.is;
|
||||||
import static org.hamcrest.CoreMatchers.nullValue;
|
import static org.hamcrest.CoreMatchers.nullValue;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
|
||||||
public class EIDHelperR4Test extends BaseR4Test {
|
public class EIDHelperR4Test extends BaseR4Test {
|
||||||
|
@ -26,9 +32,12 @@ public class EIDHelperR4Test extends BaseR4Test {
|
||||||
private static final FhirContext ourFhirContext = FhirContext.forR4();
|
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 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);
|
{
|
||||||
}};
|
setEnterpriseEIDSystem(EXTERNAL_ID_SYSTEM_FOR_TEST);
|
||||||
|
setMdmTypes(Arrays.asList(new String[] {"Patient"}));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private EmpiSettings myEmpiSettings;
|
private EmpiSettings myEmpiSettings;
|
||||||
|
|
||||||
|
@ -36,9 +45,17 @@ public class EIDHelperR4Test extends BaseR4Test {
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void before() {
|
public void before() {
|
||||||
myEmpiSettings = new EmpiSettings(new EmpiRuleValidator(ourFhirContext, mySearchParamRetriever)) {{
|
when(mySearchParamRetriever.getActiveSearchParam("Patient", "identifier"))
|
||||||
setEmpiRules(ourRules);
|
.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);
|
myEidHelper = new EIDHelper(ourFhirContext, myEmpiSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue