|
|
|
@ -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);
|
|
|
|
|