Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/test/java/org/rulez/demokracia/pdengine/CastVoteTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.rulez.demokracia.pdengine;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -42,9 +43,19 @@ public void the_preferences_can_be_obtained_when_they_contain_choices() {

@TestedBehaviour("The assurances of the voter can be obtained from a cast vote if canupdateis true")
@Test
public void the_assurances_of_the_voter_can_be_obtained_from_a_cast_vote_if_canpdate_is_true() {
public void the_assurances_of_the_voter_can_be_obtained_from_a_cast_vote_if_canupdate_is_true() {
vote.parameters.canUpdate = true;
CastVote castVote = voteManager.castVote(adminInfo.voteId, ballot, theCastVote);
assertEquals("TestAssurances", castVote.assurances.get(0));
}

@TestedBehaviour("The assurances of the voter can be obtained from a cast vote if canupdateis true")
@Test
public void the_assurances_of_the_voter_is_null_if_canupdate_is_false() {
vote.parameters.canUpdate = false;
CastVote castVote = voteManager.castVote(adminInfo.voteId, ballot, theCastVote);
System.out.println("castVote: " + castVote);
List<String> assurances = castVote.getAssurances();
assertTrue(assurances == null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,9 @@
@TestedOperation("Unimplemented")
@TestedBehaviour("Unimplemented")
public class UnimplementedTests extends CreatedDefaultChoice {

@Test
public void the_empty_assurances_can_be_obtained() {
CastVote castVote = new CastVote("test_user_in_ws_context", new ArrayList<>(), new ArrayList<>());
List<String> assurances = castVote.getAssurances();
assertTrue(assurances.isEmpty());
}

@Test
public void the_not_empty_assurances_can_be_obtained() {
List<String> assurances = new ArrayList<String> ();
assurances.add("TestAssurance");
CastVote castVote = new CastVote("test_user_in_ws_context", new ArrayList<>(), assurances);
assertTrue(castVote.getAssurances().contains("TestAssurance"));
}

// @Test
// public void the_calculateWinners_method_is_not_implemented_yet() {
// assertUnimplemented(() -> new WinnerCalculatorImpl().calculateWinners(null));
// }
}