Added asserts

This commit is contained in:
Nick Goupinets 2021-09-07 11:24:37 -04:00
parent c63a503841
commit 010628fa86
2 changed files with 32 additions and 3 deletions

View File

@ -80,7 +80,19 @@ public class MdmEventIT extends BaseMdmR4Test {
MdmLinkEvent linkChangeEvent = myMdmHelper.getAfterMdmLatch().getLatchInvocationParameterOfType(MdmLinkEvent.class);
assertNotNull(linkChangeEvent);
// MdmTransactionContext ctx = myMdmMatchLinkSvc.updateMdmLinksForMdmSource(patient2, createContextForUpdate(patient2.getIdElement().getResourceType()));
ourLog.info("Got event: {}", linkChangeEvent);
long expectTwoPossibleMatchesForPatientTwo = linkChangeEvent.getMdmLinks()
.stream()
.filter(l -> l.getSourceId().equals(patient2.getIdElement().toVersionless().getValueAsString()) && l.getMatchResult() == MdmMatchResultEnum.POSSIBLE_MATCH)
.count();
assertEquals(2, expectTwoPossibleMatchesForPatientTwo);
long expectOnePossibleDuplicate = linkChangeEvent.getMdmLinks()
.stream()
.filter(l -> l.getMatchResult() == MdmMatchResultEnum.POSSIBLE_DUPLICATE)
.count();
assertEquals(1, expectOnePossibleDuplicate);
List<MdmLinkJson> mdmLinkEvent = linkChangeEvent.getMdmLinks();
assertEquals(3, mdmLinkEvent.size());
@ -122,10 +134,9 @@ public class MdmEventIT extends BaseMdmR4Test {
assertEquals(1, linkChangeEvent.getMdmLinks().size());
MdmLinkJson link = linkChangeEvent.getMdmLinks().get(0);
assertEquals(patient1.getResourceType() + "/" + patient1.getIdElement().getIdPart(), link.getSourceId());
assertEquals(patient1.getIdElement().toVersionless().getValueAsString(), link.getSourceId());
assertEquals(getLinkByTargetId(patient1).getGoldenResourcePid(), new IdDt(link.getGoldenResourceId()).getIdPartAsLong());
assertEquals(MdmMatchResultEnum.MATCH, link.getMatchResult());
}
}

View File

@ -175,4 +175,22 @@ public class MdmLinkJson implements IModelJson {
public void setRuleCount(Long theRuleCount) {
myRuleCount = theRuleCount;
}
@Override
public String toString() {
return "MdmLinkJson{" +
"myGoldenResourceId='" + myGoldenResourceId + '\'' +
", mySourceId='" + mySourceId + '\'' +
", myMatchResult=" + myMatchResult +
", myLinkSource=" + myLinkSource +
", myCreated=" + myCreated +
", myUpdated=" + myUpdated +
", myVersion='" + myVersion + '\'' +
", myEidMatch=" + myEidMatch +
", myLinkCreatedNewResource=" + myLinkCreatedNewResource +
", myVector=" + myVector +
", myScore=" + myScore +
", myRuleCount=" + myRuleCount +
'}';
}
}