fix customresourcematcher test

This commit is contained in:
Tadgh 2020-11-16 19:42:11 -05:00
parent 9940d4c4eb
commit 23898579bd
2 changed files with 17 additions and 0 deletions

View File

@ -28,6 +28,7 @@ public class EmpiRuleValidatorTest extends BaseR4Test {
when(mySearchParamRetriever.getActiveSearchParam("Medication", "identifier")).thenReturn(mock(RuntimeSearchParam.class));
when(mySearchParamRetriever.getActiveSearchParam("AllergyIntolerance", "identifier")).thenReturn(null);
}
@Test
public void testValidate() throws IOException {
try {

View File

@ -1,5 +1,6 @@
package ca.uhn.fhir.empi.rules.svc;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.empi.BaseR4Test;
import ca.uhn.fhir.empi.api.EmpiMatchResultEnum;
import ca.uhn.fhir.empi.rules.json.EmpiFieldMatchJson;
@ -9,8 +10,14 @@ import ca.uhn.fhir.empi.rules.matcher.EmpiMatcherEnum;
import org.hl7.fhir.r4.model.HumanName;
import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class CustomResourceMatcherR4Test extends BaseR4Test {
public static final String FIELD_EXACT_MATCH_NAME = EmpiMatcherEnum.NAME_ANY_ORDER.name();
@ -23,6 +30,14 @@ public class CustomResourceMatcherR4Test extends BaseR4Test {
private static Patient ourHenryJohn;
private static Patient ourHenryJOHN;
@BeforeEach
public void before() {
when(mySearchParamRetriever.getActiveSearchParam("Patient", "identifier")).thenReturn(mock(RuntimeSearchParam.class));
when(mySearchParamRetriever.getActiveSearchParam("Practitioner", "identifier")).thenReturn(mock(RuntimeSearchParam.class));
when(mySearchParamRetriever.getActiveSearchParam("Medication", "identifier")).thenReturn(mock(RuntimeSearchParam.class));
when(mySearchParamRetriever.getActiveSearchParam("AllergyIntolerance", "identifier")).thenReturn(null);
}
@Test
public void testExactNameAnyOrder() {
EmpiResourceMatcherSvc nameAnyOrderMatcher = buildMatcher(buildNameRules(EmpiMatcherEnum.NAME_ANY_ORDER, true));
@ -86,6 +101,7 @@ public class CustomResourceMatcherR4Test extends BaseR4Test {
EmpiRulesJson retval = new EmpiRulesJson();
retval.addMatchField(nameAnyOrderFieldMatch);
retval.setMdmTypes(Arrays.asList("Patient", "Practitioner", "Medication"));
retval.putMatchResult(FIELD_EXACT_MATCH_NAME, EmpiMatchResultEnum.MATCH);
return retval;