2323import java .util .List ;
2424
2525import org .assertj .core .api .Assertions ;
26+ import org .assertj .core .api .InstanceOfAssertFactories ;
2627import org .junit .jupiter .api .Test ;
2728import org .junit .jupiter .api .TestInfo ;
2829import org .junit .jupiter .api .TestInstance ;
3132import org .junit .platform .testkit .engine .Execution ;
3233import org .junitpioneer .testkit .ExecutionResults ;
3334import org .junitpioneer .testkit .PioneerTestKit ;
35+ import org .opentest4j .MultipleFailuresError ;
36+ import org .opentest4j .TestAbortedException ;
3437
3538class RetryingTestExtensionTests {
3639
@@ -111,6 +114,7 @@ void failsOnlyOnFirstInvocationWithUnexpectedException_executedOnce_fails() {
111114 .executeTestMethod (RetryingTestTestCases .class , "failsOnlyOnFirstInvocationWithUnexpectedException" );
112115
113116 assertThat (results ).hasNumberOfDynamicallyRegisteredTests (1 ).hasNumberOfFailedTests (1 );
117+ assertThat (results ).hasSingleFailedTest ().withExceptionInstanceOf (NullPointerException .class );
114118 }
115119
116120 @ Test
@@ -122,6 +126,8 @@ void failsOnlyOnFirstInvocationWithUnexpectedException_executedTwice_fails() {
122126 .hasNumberOfDynamicallyRegisteredTests (2 )
123127 .hasNumberOfAbortedTests (1 )
124128 .hasNumberOfFailedTests (1 );
129+
130+ assertThat (results ).hasSingleFailedTest ().withExceptionInstanceOf (NullPointerException .class );
125131 }
126132
127133 @ Test
@@ -132,6 +138,8 @@ void failsAlways_executedThreeTimes_fails() {
132138 .hasNumberOfDynamicallyRegisteredTests (3 )
133139 .hasNumberOfAbortedTests (2 )
134140 .hasNumberOfFailedTests (1 );
141+
142+ assertFailedTest (results );
135143 }
136144
137145 @ Test
@@ -184,6 +192,9 @@ void executesOnceWithThreeFails_fails() {
184192 .hasNumberOfAbortedTests (2 )
185193 .hasNumberOfFailedTests (1 )
186194 .hasNumberOfSucceededTests (1 );
195+
196+ assertFailedTest (results );
197+
187198 }
188199
189200 @ Test
@@ -195,6 +206,8 @@ void failsThreeTimes_fails() {
195206 .hasNumberOfAbortedTests (2 )
196207 .hasNumberOfFailedTests (1 )
197208 .hasNumberOfSucceededTests (0 );
209+
210+ assertFailedTest (results );
198211 }
199212
200213 @ Test
@@ -279,6 +292,7 @@ void failThreeTimesWithSuspend() {
279292 .hasNumberOfSucceededTests (0 );
280293
281294 assertSuspendedFor (results , SUSPEND_FOR );
295+ assertFailedTest (results );
282296 }
283297
284298 @ Test
@@ -293,6 +307,7 @@ void failThreeTimesWithoutSuspend() {
293307 .hasNumberOfSucceededTests (0 );
294308
295309 assertSuspendedFor (results , 0 );
310+ assertFailedTest (results );
296311 }
297312
298313 private void assertSuspendedFor (ExecutionResults results , long greaterThanOrEqualTo ) {
@@ -315,6 +330,17 @@ private void assertSuspendedFor(ExecutionResults results, long greaterThanOrEqua
315330 }
316331 }
317332
333+ private void assertFailedTest (ExecutionResults results ) {
334+ assertThat (results )
335+ .hasSingleFailedTest ()
336+ .withExceptionInstanceOf (MultipleFailuresError .class )
337+ .extracting (MultipleFailuresError ::getFailures , InstanceOfAssertFactories .list (Throwable .class ))
338+ .hasSize (3 )
339+ .hasOnlyElementsOfType (TestAbortedException .class )
340+ .extracting (Throwable ::getCause )
341+ .hasOnlyElementsOfType (IllegalArgumentException .class );
342+ }
343+
318344 // TEST CASES -------------------------------------------------------------------
319345
320346 // Some tests require state to keep track of the number of test executions.
0 commit comments