@Test public void recalculateMatchStrength_DONT_match() { when(voter.voteMatch(affiliation, organization)).thenReturn(false); when(affMatchResult.getMatchStrength()).thenReturn(0.7f); when(voter.getMatchStrength()).thenReturn(0.5f); AffMatchResult recalcAffMatchResult = recalculator.recalculateMatchStrength(affMatchResult, voter); assertEquals(0.7f, recalcAffMatchResult.getMatchStrength(), 0.0001); assertTrue(affiliation == recalcAffMatchResult.getAffiliation()); assertTrue(organization == recalcAffMatchResult.getOrganization()); }
public AffMatchResult recalculateMatchStrength(AffMatchResult affMatchResult, AffOrgMatchVoter voter) { Preconditions.checkNotNull(affMatchResult); Preconditions.checkNotNull(voter); float matchStrength = affMatchResult.getMatchStrength(); if (voter.voteMatch(affMatchResult.getAffiliation(), affMatchResult.getOrganization())) { matchStrength = (matchStrength + voter.getMatchStrength()) - matchStrength * voter.getMatchStrength(); } return new AffMatchResult(affMatchResult.getAffiliation(), affMatchResult.getOrganization(), matchStrength); }
AffOrgMatchStrengthRecalculator implements Serializable { public AffMatchResult recalculateMatchStrength(AffMatchResult affMatchResult, AffOrgMatchVoter voter) { Preconditions.checkNotNull(affMatchResult); Preconditions.checkNotNull(voter); float matchStrength = affMatchResult.getMatchStrength(); if (voter.voteMatch(affMatchResult.getAffiliation(), affMatchResult.getOrganization())) { matchStrength = (matchStrength + voter.getMatchStrength()) - matchStrength * voter.getMatchStrength(); } return new AffMatchResult(affMatchResult.getAffiliation(), affMatchResult.getOrganization(), matchStrength); } }
AffOrgMatchStrengthRecalculator implements Serializable { public AffMatchResult recalculateMatchStrength(AffMatchResult affMatchResult, AffOrgMatchVoter voter) { Preconditions.checkNotNull(affMatchResult); Preconditions.checkNotNull(voter); float matchStrength = affMatchResult.getMatchStrength(); if (voter.voteMatch(affMatchResult.getAffiliation(), affMatchResult.getOrganization())) { matchStrength = (matchStrength + voter.getMatchStrength()) - matchStrength * voter.getMatchStrength(); } return new AffMatchResult(affMatchResult.getAffiliation(), affMatchResult.getOrganization(), matchStrength); }  }
AffOrgMatchStrengthRecalculator implements Serializable { public AffMatchResult recalculateMatchStrength(AffMatchResult affMatchResult, AffOrgMatchVoter voter) { Preconditions.checkNotNull(affMatchResult); Preconditions.checkNotNull(voter); float matchStrength = affMatchResult.getMatchStrength(); if (voter.voteMatch(affMatchResult.getAffiliation(), affMatchResult.getOrganization())) { matchStrength = (matchStrength + voter.getMatchStrength()) - matchStrength * voter.getMatchStrength(); } return new AffMatchResult(affMatchResult.getAffiliation(), affMatchResult.getOrganization(), matchStrength); }  AffMatchResult recalculateMatchStrength(AffMatchResult affMatchResult, AffOrgMatchVoter voter); }
AffOrgMatchStrengthRecalculator implements Serializable { public AffMatchResult recalculateMatchStrength(AffMatchResult affMatchResult, AffOrgMatchVoter voter) { Preconditions.checkNotNull(affMatchResult); Preconditions.checkNotNull(voter); float matchStrength = affMatchResult.getMatchStrength(); if (voter.voteMatch(affMatchResult.getAffiliation(), affMatchResult.getOrganization())) { matchStrength = (matchStrength + voter.getMatchStrength()) - matchStrength * voter.getMatchStrength(); } return new AffMatchResult(affMatchResult.getAffiliation(), affMatchResult.getOrganization(), matchStrength); }  AffMatchResult recalculateMatchStrength(AffMatchResult affMatchResult, AffOrgMatchVoter voter);  }