use of org.mamute.model.Vote in project mamute by caelum.
the class VotingMachineTest method should_substitute_vote_and_decrease_count.
@Test
public void should_substitute_vote_and_decrease_count() {
Vote previousVote = vote(voter, VoteType.UP, 1l);
votingMachine.register(votable, previousVote, Question.class);
when(votes.previousVoteFor(votable.getId(), voter, Question.class)).thenReturn(previousVote);
Vote newVote = new Vote(voter, VoteType.DOWN);
votingMachine.register(votable, newVote, Question.class);
assertEquals(-1, votable.getVoteCount());
}
Aggregations