From e6f484cefd0102cda7a7ae266a92838b2f59437f Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 14 Jan 2021 10:52:28 -0500 Subject: [PATCH] Added tests --- .../svc/MdmGoldenResourceMergerSvcTest.java | 20 +++++++++++++++++-- .../mdm/svc/MdmSurvivorshipSvcImplTest.java | 7 +++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmSurvivorshipSvcImplTest.java diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmGoldenResourceMergerSvcTest.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmGoldenResourceMergerSvcTest.java index 04d5821e042..8fafbaf93b4 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmGoldenResourceMergerSvcTest.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmGoldenResourceMergerSvcTest.java @@ -106,8 +106,6 @@ public class MdmGoldenResourceMergerSvcTest extends BaseMdmR4Test { return retval; } - // TODO NG - add a test with a manually merged golden patient - private int redirectLinkCount() { MdmLink mdmLink = new MdmLink().setMatchResult(MdmMatchResultEnum.REDIRECT); Example example = Example.of(mdmLink); @@ -173,6 +171,24 @@ public class MdmGoldenResourceMergerSvcTest extends BaseMdmR4Test { 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 public void fromLinkToNoLink() { createMdmLink(myFromGoldenPatient, myTargetPatient1); diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmSurvivorshipSvcImplTest.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmSurvivorshipSvcImplTest.java new file mode 100644 index 00000000000..70aaae2d0c8 --- /dev/null +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmSurvivorshipSvcImplTest.java @@ -0,0 +1,7 @@ +package ca.uhn.fhir.jpa.mdm.svc; + +import static org.junit.jupiter.api.Assertions.*; + +class MdmSurvivorshipSvcImplTest { + +}