Search in sources :

Example 1 with ElectionVote

use of com.github.dedis.popstellar.model.network.method.message.data.election.ElectionVote in project popstellar by dedis.

the class ElectionTest method settingSameRegisteredVotesAndComparingReturnsTrue.

@Test
public void settingSameRegisteredVotesAndComparingReturnsTrue() {
    List<ElectionVote> votes1 = Arrays.asList(new ElectionVote("b", Collections.singletonList(1), false, "", "my election id"), new ElectionVote("a", Collections.singletonList(2), false, "", "my election id"));
    List<ElectionVote> votes2 = Arrays.asList(new ElectionVote("c", Collections.singletonList(3), false, "", "my election id"), new ElectionVote("d", Collections.singletonList(4), false, "", "my election id"));
    election.putVotesBySender(SENDER_2, votes2);
    election.putSenderByMessageId(SENDER_1, MESSAGE_ID_1);
    election.putSenderByMessageId(SENDER_2, MESSAGE_ID_2);
    election.putVotesBySender(SENDER_1, votes1);
    String hash = Hash.hash(votes1.get(1).getId(), votes1.get(0).getId(), votes2.get(0).getId(), votes2.get(1).getId());
    assertThat(election.computerRegisteredVotes(), is(hash));
}
Also used : ElectionVote(com.github.dedis.popstellar.model.network.method.message.data.election.ElectionVote) Test(org.junit.Test)

Aggregations

ElectionVote (com.github.dedis.popstellar.model.network.method.message.data.election.ElectionVote)1 Test (org.junit.Test)1