Allow tests to run concurrently
This commit is contained in:
@@ -25,7 +25,7 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
systemProperty 'junit.jupiter.execution.parallel.enabled', false
|
systemProperty 'junit.jupiter.execution.parallel.enabled', true
|
||||||
systemProperty 'junit.jupiter.execution.parallel.mode.default', "concurrent"
|
systemProperty 'junit.jupiter.execution.parallel.mode.default', "concurrent"
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
maxHeapSize = "4g"
|
maxHeapSize = "4g"
|
||||||
|
|||||||
+9
-6
@@ -18,6 +18,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.assertj.core.api.Assertions;
|
import org.assertj.core.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.lang.NonNull;
|
import org.springframework.lang.NonNull;
|
||||||
@@ -70,6 +71,12 @@ class CalculationServiceTest {
|
|||||||
|
|
||||||
private CalculationService service;
|
private CalculationService service;
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
|
static void setUpOverall() {
|
||||||
|
setUpCandidatesOverall();
|
||||||
|
setUpResultsOverall();
|
||||||
|
}
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setService() {
|
void setService() {
|
||||||
service = new CalculationService();
|
service = new CalculationService();
|
||||||
@@ -115,8 +122,6 @@ class CalculationServiceTest {
|
|||||||
GRUENE_BEZIRK,
|
GRUENE_BEZIRK,
|
||||||
AFD_BEZIRK
|
AFD_BEZIRK
|
||||||
);
|
);
|
||||||
setUpCandidatesOverall();
|
|
||||||
setUpResultsOverall();
|
|
||||||
|
|
||||||
SeatResult result = service.calculateOverallSeatDistribution(election, nominations);
|
SeatResult result = service.calculateOverallSeatDistribution(election, nominations);
|
||||||
|
|
||||||
@@ -131,8 +136,6 @@ class CalculationServiceTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldCalculateOverallCandidatesCorrectly() {
|
void shouldCalculateOverallCandidatesCorrectly() {
|
||||||
setUpCandidatesOverall();
|
|
||||||
setUpResultsOverall();
|
|
||||||
Map<Nomination, Integer> seatsPerNomination = Map.of(
|
Map<Nomination, Integer> seatsPerNomination = Map.of(
|
||||||
SPD_BEZIRK, 2,
|
SPD_BEZIRK, 2,
|
||||||
CDU_BEZIRK, 2,
|
CDU_BEZIRK, 2,
|
||||||
@@ -308,7 +311,7 @@ class CalculationServiceTest {
|
|||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpCandidatesOverall() {
|
private static void setUpCandidatesOverall() {
|
||||||
SPD_BEZIRK.addCandidates(buildCandidates(
|
SPD_BEZIRK.addCandidates(buildCandidates(
|
||||||
GOTTLIEB_GABOR, "Meding, Sarah", "Harringa, Nils", "Nendza-Ammar, Charlotte",
|
GOTTLIEB_GABOR, "Meding, Sarah", "Harringa, Nils", "Nendza-Ammar, Charlotte",
|
||||||
"Rust, Rüdiger", "Köster-Marjanovic, Hannelore", RIEGEL_ANN_KATHRIN, "Rüter, Monika",
|
"Rust, Rüdiger", "Köster-Marjanovic, Hannelore", RIEGEL_ANN_KATHRIN, "Rüter, Monika",
|
||||||
@@ -372,7 +375,7 @@ class CalculationServiceTest {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpResultsOverall() {
|
private static void setUpResultsOverall() {
|
||||||
SPD_BEZIRK.setVotingResult(VotingResult.builder()
|
SPD_BEZIRK.setVotingResult(VotingResult.builder()
|
||||||
.votesOnNomination(84703)
|
.votesOnNomination(84703)
|
||||||
.votesThroughHealing(985)
|
.votesThroughHealing(985)
|
||||||
|
|||||||
Reference in New Issue
Block a user