fix: whitespace hell (we need a linter!)

Also, add another test-case with thousands of participants.
pull/4/head
Dominique Merle 3 years ago
parent 2cbb7c45d8
commit 5ab34db580

@ -2,8 +2,6 @@ package fr.mieuxvoter.mj;
import static org.junit.jupiter.api.Assertions.*;
import java.util.stream.Stream;
import javax.json.JsonArray;
import javax.json.JsonObject;
import javax.json.JsonValue;
@ -11,9 +9,6 @@ import javax.json.JsonValue;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import net.joshka.junit.json.params.JsonFileSource;
//import net.joshka.junit.json.params.JsonObject;
@ -61,6 +56,7 @@ class MajorityJudgmentDeliberatorTest {
public void testFromJson(JsonObject datum) {
JsonArray jsonTallies = datum.getJsonArray("tallies");
int amountOfProposals = jsonTallies.size();
Long amountOfParticipants = Long.valueOf(datum.get("participants").toString());
ProposalTallyInterface[] tallies = new ProposalTallyInterface[amountOfProposals];
for (int i = 0; i < amountOfProposals; i++) {
JsonArray jsonTally = jsonTallies.getJsonArray(i);
@ -73,7 +69,7 @@ class MajorityJudgmentDeliberatorTest {
tallies[i] = new ProposalTally(tally);
}
DeliberatorInterface mj = new MajorityJudgmentDeliberator();
TallyInterface tally = new Tally(tallies, 3L);
TallyInterface tally = new Tally(tallies, amountOfParticipants);
ResultInterface result = mj.deliberate(tally);
assertNotNull(result);

@ -1,7 +1,8 @@
[
{
"title": "Few judgments",
"title": "Few participants",
"participants": 3,
"tallies": [
[1, 1, 1],
[1, 0, 2],
@ -16,6 +17,20 @@
4,
2
]
},
{
"title": "Thousands of participants",
"participants": 37000,
"tallies": [
[11142, 6970, 4040, 1968, 9888, 2992],
[10141, 8971, 4043, 1965, 8884, 2996],
[14141, 8971, 1043, 1965, 7884, 2996]
],
"ranks": [
1,
2,
3
]
}
]

Loading…
Cancel
Save