Skip to content

Commit 0182e4b

Browse files
committed
Assert all conditions of executesTestMethodsInParallel at once
The test is flakey. Presumably due to either a slow machine or a coarse clock. If all other conditions hold we can rule out unintended serial execution.
1 parent 8f4e55d commit 0182e4b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

junit-vintage-engine/src/test/java/org/junit/vintage/engine/execution/ParallelExecutionIntegrationTests.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
package org.junit.vintage.engine.execution;
1212

1313
import static org.assertj.core.api.Assertions.assertThat;
14+
import static org.junit.jupiter.api.Assertions.assertAll;
1415
import static org.junit.jupiter.api.Assertions.assertTrue;
1516
import static org.junit.platform.testkit.engine.EventConditions.container;
1617
import static org.junit.platform.testkit.engine.EventConditions.event;
@@ -91,11 +92,12 @@ void executesTestMethodsInParallel(TestReporter reporter) {
9192
reporter.publishEntry("startedTimestamps", startedTimestamps.toString());
9293
reporter.publishEntry("finishedTimestamps", finishedTimestamps.toString());
9394

94-
assertThat(startedTimestamps).hasSize(3);
95-
assertThat(finishedTimestamps).hasSize(3);
96-
assertThat(startedTimestamps).allMatch(startTimestamp -> finishedTimestamps.stream().noneMatch(
97-
finishedTimestamp -> finishedTimestamp.isBefore(startTimestamp)));
98-
assertThat(threadNames).hasSize(3);
95+
assertAll( //
96+
() -> assertThat(startedTimestamps).hasSize(3), //
97+
() -> assertThat(finishedTimestamps).hasSize(3), //
98+
() -> assertThat(startedTimestamps).allMatch(startTimestamp -> finishedTimestamps.stream().noneMatch( //
99+
finishedTimestamp -> finishedTimestamp.isBefore(startTimestamp))), //
100+
() -> assertThat(threadNames).hasSize(3));
99101
}
100102

101103
@Test

0 commit comments

Comments
 (0)