Skip to content

Commit

Permalink
Winner as a string in metadata; tests passing.
Browse files Browse the repository at this point in the history
  • Loading branch information
vteague committed Jun 9, 2024
1 parent dfb590d commit 52a3f85
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ the raire assertion generation engine (https://github.com/DemocracyDevelopers/ra
import static au.org.democracydevelopers.raireservice.testUtils.correctMetadata;
import static au.org.democracydevelopers.raireservice.testUtils.correctSolutionData;
import static au.org.democracydevelopers.raireservice.testUtils.defaultCountJson;
import static au.org.democracydevelopers.raireservice.testUtils.defaultWinnerJSON;
import static au.org.democracydevelopers.raireservice.testUtils.getAssertionsJSONEndpoint;
import static au.org.democracydevelopers.raireservice.testUtils.oneNEBAssertionContest;
import static au.org.democracydevelopers.raireservice.testUtils.oneNEBOneNENAssertionContest;
import static au.org.democracydevelopers.raireservice.testUtils.oneNENAssertionContest;
import static au.org.democracydevelopers.raireservice.testUtils.defaultWinner;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down Expand Up @@ -107,7 +105,7 @@ public void getAssertionsWithOneNEBContest() {
String url = baseURL + port + getAssertionsJSONEndpoint;

String requestAsJson = "{\"riskLimit\":0.05,\"contestName\":\"" + oneNEBAssertionContest + "\","
+ defaultCountJson + "," + defaultWinnerJSON + "," + "\"candidates\":[\"Alice\",\"Bob\"]}";
+ defaultCountJson + "," + "\"winner\":\"Bob\"" + "," + "\"candidates\":[\"Alice\",\"Bob\"]}";

HttpEntity<String> request = new HttpEntity<>(requestAsJson, httpHeaders);
ResponseEntity<String> response = restTemplate.postForEntity(url, request, String.class);
Expand All @@ -127,7 +125,7 @@ void retrieveAssertionsExistentContestOneNEBAssertion() {

// Make the request.
GetAssertionsRequest request = new GetAssertionsRequest(oneNEBAssertionContest, defaultCount,
List.of("Alice","Bob"), defaultWinner, BigDecimal.valueOf(0.1));
List.of("Alice","Bob"), "Bob", BigDecimal.valueOf(0.1));
ResponseEntity<RaireSolution> response
= restTemplate.postForEntity(url, request, RaireSolution.class);

Expand Down Expand Up @@ -157,7 +155,7 @@ void retrieveAssertionsExistentContestOneNENAssertion() {
String url = baseURL + port + getAssertionsJSONEndpoint;

GetAssertionsRequest request = new GetAssertionsRequest(oneNENAssertionContest, defaultCount,
List.of("Alice","Bob","Charlie","Diego"), defaultWinner, BigDecimal.valueOf(0.1));
List.of("Alice","Bob","Charlie","Diego"), "Alice", BigDecimal.valueOf(0.1));
ResponseEntity<RaireSolution> response = restTemplate.postForEntity(url, request, RaireSolution.class);

// The metadata has been constructed appropriately
Expand Down Expand Up @@ -188,7 +186,7 @@ void retrieveAssertionsIncorrectCandidateNamesIsAnError() {
String url = baseURL + port + getAssertionsJSONEndpoint;

GetAssertionsRequest request = new GetAssertionsRequest(oneNEBOneNENAssertionContest,
defaultCount, List.of("Alice","Bob","Charlie","Diego"), defaultWinner, BigDecimal.valueOf(0.1));
defaultCount, List.of("Alice","Bob","Charlie","Diego"), "Alice", BigDecimal.valueOf(0.1));
ResponseEntity<String> response
= restTemplate.postForEntity(url, request, String.class);

Expand Down

0 comments on commit 52a3f85

Please sign in to comment.