Added tests

This commit is contained in:
Nick 2021-01-14 10:52:28 -05:00
parent 24204f4425
commit e6f484cefd
2 changed files with 25 additions and 2 deletions

View File

@ -106,8 +106,6 @@ public class MdmGoldenResourceMergerSvcTest extends BaseMdmR4Test {
return retval; return retval;
} }
// TODO NG - add a test with a manually merged golden patient
private int redirectLinkCount() { private int redirectLinkCount() {
MdmLink mdmLink = new MdmLink().setMatchResult(MdmMatchResultEnum.REDIRECT); MdmLink mdmLink = new MdmLink().setMatchResult(MdmMatchResultEnum.REDIRECT);
Example<MdmLink> example = Example.of(mdmLink); Example<MdmLink> example = Example.of(mdmLink);
@ -173,6 +171,24 @@ public class MdmGoldenResourceMergerSvcTest extends BaseMdmR4Test {
assertEquals(POSTAL_CODE, mergedSourcePatient.getAddressFirstRep().getPostalCode()); assertEquals(POSTAL_CODE, mergedSourcePatient.getAddressFirstRep().getPostalCode());
} }
@Test
public void testManualOverride() {
Patient manuallyMergedPatient = new Patient();
populatePatient(manuallyMergedPatient);
manuallyMergedPatient.getNameFirstRep().setFamily("TestFamily");
manuallyMergedPatient.getNameFirstRep().getGiven().clear();
manuallyMergedPatient.getNameFirstRep().addGiven("TestGiven");
MdmTransactionContext ctx = createMdmContext();
ctx.setRestOperation(MdmTransactionContext.OperationType.MANUAL_MERGE_GOLDEN_RESOURCES);
Patient mergedSourcePatient = (Patient) myGoldenResourceMergerSvc
.mergeGoldenResources(myFromGoldenPatient, manuallyMergedPatient, myToGoldenPatient, ctx);
HumanName returnedName = mergedSourcePatient.getNameFirstRep();
assertEquals("TestGiven TestFamily", returnedName.getNameAsSingleString());
assertEquals(POSTAL_CODE, mergedSourcePatient.getAddressFirstRep().getPostalCode());
}
@Test @Test
public void fromLinkToNoLink() { public void fromLinkToNoLink() {
createMdmLink(myFromGoldenPatient, myTargetPatient1); createMdmLink(myFromGoldenPatient, myTargetPatient1);

View File

@ -0,0 +1,7 @@
package ca.uhn.fhir.jpa.mdm.svc;
import static org.junit.jupiter.api.Assertions.*;
class MdmSurvivorshipSvcImplTest {
}