Search in sources :

Example 1 with VoteResult

use of org.apache.pivot.util.VoteResult in project pivot by apache.

the class VoteResultTest method test1.

@Test
public void test1() {
    ArrayList<Vote> votes = new ArrayList<>();
    votes.add(Vote.APPROVE);
    votes.add(Vote.DEFER);
    votes.add(Vote.DENY);
    // These are the expected results as each vote is tallied
    ArrayList<Vote> results = new ArrayList<>();
    results.add(Vote.APPROVE);
    results.add(Vote.DEFER);
    results.add(Vote.DENY);
    VoteResult result = new VoteResult();
    Iterator<Vote> resultIter = results.iterator();
    for (Vote vote : votes) {
        result.tally(vote);
        assertEquals(result.get(), resultIter.next());
    }
}
Also used : Vote(org.apache.pivot.util.Vote) ArrayList(org.apache.pivot.collections.ArrayList) VoteResult(org.apache.pivot.util.VoteResult) Test(org.junit.Test)

Aggregations

ArrayList (org.apache.pivot.collections.ArrayList)1 Vote (org.apache.pivot.util.Vote)1 VoteResult (org.apache.pivot.util.VoteResult)1 Test (org.junit.Test)1