@@ -77,7 +77,7 @@ void constructorParameter() {
7777
7878 @ Test
7979 void constructorParameterForNestedTestClass () {
80- assertOneTestSucceeded (NestedConstructorParameterTestCase .class );
80+ assertTestsSucceeded (NestedConstructorParameterTestCase .class , 2 );
8181 }
8282
8383 @ Test
@@ -210,10 +210,11 @@ void afterEach(Long number, TestInfo testInfo, @MagicParameter("method") String
210210 @ ExtendWith (LongParameterResolver .class )
211211 class NestedConstructorParameterTestCase {
212212
213- NestedConstructorParameterTestCase (@ MagicParameter ("constructor" ) String text ) {
214- // Index is 1 instead of 0, since constructors for non-static nested classes
213+ NestedConstructorParameterTestCase (TestInfo testInfo , @ MagicParameter ("constructor" ) String text ) {
214+ assertThat (testInfo ).isNotNull ();
215+ // Index is 2 instead of 1, since constructors for non-static nested classes
215216 // receive a reference to the enclosing instance as the first argument: this$0
216- assertThat (text ).isEqualTo ("NestedConstructorParameterTestCase-1 -constructor" );
217+ assertThat (text ).isEqualTo ("NestedConstructorParameterTestCase-2 -constructor" );
217218 }
218219
219220 @ BeforeEach
@@ -239,6 +240,40 @@ void afterEach(Long number, TestInfo testInfo, @MagicParameter("method") String
239240 assertThat (text ).isEqualTo ("afterEach-2-method" );
240241 }
241242
243+ @ Nested
244+ class DoublyNestedConstructorParameterTestCase {
245+
246+ DoublyNestedConstructorParameterTestCase (TestInfo testInfo , String text ) {
247+ assertThat (testInfo ).isNotNull ();
248+ // Index is 2 instead of 1, since constructors for non-static nested classes
249+ // receive a reference to the enclosing instance as the first argument: this$0
250+ assertThat (text ).isEqualTo ("DoublyNestedConstructorParameterTestCase-2-enigma" );
251+ }
252+
253+ @ BeforeEach
254+ void beforeEach (String text , TestInfo testInfo ) {
255+ assertThat (text ).isEqualTo ("beforeEach-0-enigma" );
256+ assertThat (testInfo ).isNotNull ();
257+ }
258+
259+ @ Test
260+ void test (TestInfo testInfo , String text ) {
261+ assertThat (testInfo ).isNotNull ();
262+ assertThat (text ).isEqualTo ("test-1-enigma" );
263+ }
264+
265+ /**
266+ * Redeclaring {@code @MagicParameter} should not result in a
267+ * {@link ParameterResolutionException}.
268+ */
269+ @ AfterEach
270+ void afterEach (Long number , TestInfo testInfo , @ MagicParameter ("method" ) String text ) {
271+ assertThat (number ).isEqualTo (42L );
272+ assertThat (testInfo ).isNotNull ();
273+ assertThat (text ).isEqualTo ("afterEach-2-method" );
274+ }
275+ }
276+
242277 }
243278
244279 /**
0 commit comments