@Test(expected = IllegalArgumentException.class) public void recalculateStrength_DIFFERENT_ORG_ID() { matchedOrganization2.setOrganizationId("OTHER_ORG_ID"); strengthRecalculator.recalculateStrength(matchedOrganization1, matchedOrganization2); }
public MatchedOrganization recalculateStrength(MatchedOrganization match1, MatchedOrganization match2) { Preconditions.checkNotNull(match1); Preconditions.checkNotNull(match2); Preconditions.checkArgument(match1.getDocumentId().equals(match2.getDocumentId())); Preconditions.checkArgument(match1.getOrganizationId().equals(match2.getOrganizationId())); float remainingMatchStrength = 1 - match1.getMatchStrength(); float newMatchStrength = match1.getMatchStrength() + (remainingMatchStrength * match2.getMatchStrength()); return new MatchedOrganization(match1.getDocumentId(), match1.getOrganizationId(), newMatchStrength); }
DuplicateMatchedOrgStrengthRecalculator implements Serializable { public MatchedOrganization recalculateStrength(MatchedOrganization match1, MatchedOrganization match2) { Preconditions.checkNotNull(match1); Preconditions.checkNotNull(match2); Preconditions.checkArgument(match1.getDocumentId().equals(match2.getDocumentId())); Preconditions.checkArgument(match1.getOrganizationId().equals(match2.getOrganizationId())); float remainingMatchStrength = 1 - match1.getMatchStrength(); float newMatchStrength = match1.getMatchStrength() + (remainingMatchStrength * match2.getMatchStrength()); return new MatchedOrganization(match1.getDocumentId(), match1.getOrganizationId(), newMatchStrength); } }
DuplicateMatchedOrgStrengthRecalculator implements Serializable { public MatchedOrganization recalculateStrength(MatchedOrganization match1, MatchedOrganization match2) { Preconditions.checkNotNull(match1); Preconditions.checkNotNull(match2); Preconditions.checkArgument(match1.getDocumentId().equals(match2.getDocumentId())); Preconditions.checkArgument(match1.getOrganizationId().equals(match2.getOrganizationId())); float remainingMatchStrength = 1 - match1.getMatchStrength(); float newMatchStrength = match1.getMatchStrength() + (remainingMatchStrength * match2.getMatchStrength()); return new MatchedOrganization(match1.getDocumentId(), match1.getOrganizationId(), newMatchStrength); }  }
DuplicateMatchedOrgStrengthRecalculator implements Serializable { public MatchedOrganization recalculateStrength(MatchedOrganization match1, MatchedOrganization match2) { Preconditions.checkNotNull(match1); Preconditions.checkNotNull(match2); Preconditions.checkArgument(match1.getDocumentId().equals(match2.getDocumentId())); Preconditions.checkArgument(match1.getOrganizationId().equals(match2.getOrganizationId())); float remainingMatchStrength = 1 - match1.getMatchStrength(); float newMatchStrength = match1.getMatchStrength() + (remainingMatchStrength * match2.getMatchStrength()); return new MatchedOrganization(match1.getDocumentId(), match1.getOrganizationId(), newMatchStrength); }  MatchedOrganization recalculateStrength(MatchedOrganization match1, MatchedOrganization match2); }
DuplicateMatchedOrgStrengthRecalculator implements Serializable { public MatchedOrganization recalculateStrength(MatchedOrganization match1, MatchedOrganization match2) { Preconditions.checkNotNull(match1); Preconditions.checkNotNull(match2); Preconditions.checkArgument(match1.getDocumentId().equals(match2.getDocumentId())); Preconditions.checkArgument(match1.getOrganizationId().equals(match2.getOrganizationId())); float remainingMatchStrength = 1 - match1.getMatchStrength(); float newMatchStrength = match1.getMatchStrength() + (remainingMatchStrength * match2.getMatchStrength()); return new MatchedOrganization(match1.getDocumentId(), match1.getOrganizationId(), newMatchStrength); }  MatchedOrganization recalculateStrength(MatchedOrganization match1, MatchedOrganization match2);  }