@Test public void voteMatch_match_when_all_matched() { when(voter1.voteMatch(affiliation, organization)).thenReturn(true); when(voter2.voteMatch(affiliation, organization)).thenReturn(true); boolean returnValue = compositeMatchVoter.voteMatch(affiliation, organization); assertTrue(returnValue); verify(voter1).voteMatch(affiliation, organization); verify(voter2).voteMatch(affiliation, organization); verifyNoMoreInteractions(voter1, voter2); }
@Override public boolean voteMatch(AffMatchAffiliation affiliation, AffMatchOrganization organization) { for (AffOrgMatchVoter matchVoter : voters) { if (!matchVoter.voteMatch(affiliation, organization)) { return false; } } return true; }
CompositeMatchVoter extends AbstractAffOrgMatchVoter { @Override public boolean voteMatch(AffMatchAffiliation affiliation, AffMatchOrganization organization) { for (AffOrgMatchVoter matchVoter : voters) { if (!matchVoter.voteMatch(affiliation, organization)) { return false; } } return true; } }
CompositeMatchVoter extends AbstractAffOrgMatchVoter { @Override public boolean voteMatch(AffMatchAffiliation affiliation, AffMatchOrganization organization) { for (AffOrgMatchVoter matchVoter : voters) { if (!matchVoter.voteMatch(affiliation, organization)) { return false; } } return true; } CompositeMatchVoter(List<AffOrgMatchVoter> voters); }
CompositeMatchVoter extends AbstractAffOrgMatchVoter { @Override public boolean voteMatch(AffMatchAffiliation affiliation, AffMatchOrganization organization) { for (AffOrgMatchVoter matchVoter : voters) { if (!matchVoter.voteMatch(affiliation, organization)) { return false; } } return true; } CompositeMatchVoter(List<AffOrgMatchVoter> voters); @Override boolean voteMatch(AffMatchAffiliation affiliation, AffMatchOrganization organization); @Override String toString(); }
CompositeMatchVoter extends AbstractAffOrgMatchVoter { @Override public boolean voteMatch(AffMatchAffiliation affiliation, AffMatchOrganization organization) { for (AffOrgMatchVoter matchVoter : voters) { if (!matchVoter.voteMatch(affiliation, organization)) { return false; } } return true; } CompositeMatchVoter(List<AffOrgMatchVoter> voters); @Override boolean voteMatch(AffMatchAffiliation affiliation, AffMatchOrganization organization); @Override String toString();  }