This is an automated email from the git hooks/post-receive script. New commit to branch feature/188_mauvais_depouillement_coombs in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit d1ae69ff37a8d52b3377a275fc8d11db9c8b5fe8 Author: Arnaud Thimel <thimel@codelutin.com> Date: Mon Jan 8 12:18:31 2018 +0100 refs #188 [Coombs] Ajout d'un test pour valider que la majorité l'emporte bien sans générer de tour superflu --- .../CoombsVoteCountingStrategyTest.java | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/pollen-votecounting-coombs/src/test/java/org/chorem/pollen/votecounting/CoombsVoteCountingStrategyTest.java b/pollen-votecounting-coombs/src/test/java/org/chorem/pollen/votecounting/CoombsVoteCountingStrategyTest.java index 9e388fb6..9cddab39 100644 --- a/pollen-votecounting-coombs/src/test/java/org/chorem/pollen/votecounting/CoombsVoteCountingStrategyTest.java +++ b/pollen-votecounting-coombs/src/test/java/org/chorem/pollen/votecounting/CoombsVoteCountingStrategyTest.java @@ -28,7 +28,6 @@ import org.chorem.pollen.votecounting.model.Voter; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import java.math.BigDecimal; @@ -42,7 +41,6 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Tony Chemit - dev@tchemit.fr * @since 1.4.5 */ -@Ignore public class CoombsVoteCountingStrategyTest { public static final String CHOICE_A = "Ville A"; @@ -306,4 +304,28 @@ public class CoombsVoteCountingStrategyTest { Assert.assertEquals(choiceResult, choiceScore.getScoreValue()); } + @Test + public void majorityOnFirstRoundTest() throws Exception { + + Set<Voter> voters = new SimpleVoterBuilder(). + newVoter("1", 1.). + addVoteForChoice(CHOICE_A, 2.). + addVoteForChoice(CHOICE_B, 4.). + addVoteForChoice(CHOICE_C, 3.). + getVoters(); + + VoteCountingResult result = strategy.votecount(voters); + + assertThat(result).isNotNull(); + assertThat(result.getScores()) + .isNotNull() + .contains( + ChoiceScore.newScore(CHOICE_A, BigDecimal.valueOf(1.0), 0)) + .isSortedAccordingTo(ChoiceScore::compareTo); + + // We have only one vote, so we have an absolute majority on first round, should not have multiple rounds + CoombsDetailResult detailResult = (CoombsDetailResult) result.getDetailResult(); + Assert.assertEquals(1, detailResult.getRounds().size()); + } + } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.