@@ -177,7 +177,7 @@ void discoverDeeplyNestedTestMethodByNestedMethodSelector() throws Exception {
177
177
@ MethodSource ("requestsForTestClassWithInvalidTestMethod" )
178
178
void reportsWarningForTestClassWithInvalidTestMethod (LauncherDiscoveryRequest request ) throws Exception {
179
179
180
- var method = InvalidTestMethodTestCase .class .getDeclaredMethod ("test" );
180
+ var method = InvalidTestCases . InvalidTestMethodTestCase .class .getDeclaredMethod ("test" );
181
181
182
182
var results = discoverTests (request );
183
183
@@ -194,14 +194,15 @@ void reportsWarningForTestClassWithInvalidTestMethod(LauncherDiscoveryRequest re
194
194
195
195
static List <Named <LauncherDiscoveryRequest >> requestsForTestClassWithInvalidTestMethod () {
196
196
return List .of ( //
197
- named ("directly selected" , request ().selectors (selectClass (InvalidTestMethodTestCase .class )).build ()), //
197
+ named ("directly selected" ,
198
+ request ().selectors (selectClass (InvalidTestCases .InvalidTestMethodTestCase .class )).build ()), //
198
199
named ("indirectly selected" , request () //
199
- .selectors (selectPackage (InvalidTestMethodTestCase .class .getPackageName ())) //
200
- .filters (
201
- includeClassNamePatterns ( Pattern .quote (InvalidTestMethodTestCase .class .getName ()))).build ()), //
200
+ .selectors (selectPackage (InvalidTestCases . InvalidTestMethodTestCase .class .getPackageName ())) //
201
+ .filters (includeClassNamePatterns (
202
+ Pattern .quote (InvalidTestCases . InvalidTestMethodTestCase .class .getName ()))).build ()), //
202
203
named ("subclasses" , request () //
203
- .selectors (selectClass (InvalidTestMethodSubclass1TestCase .class ),
204
- selectClass (InvalidTestMethodSubclass2TestCase .class )) //
204
+ .selectors (selectClass (InvalidTestCases . InvalidTestMethodSubclass1TestCase .class ),
205
+ selectClass (InvalidTestCases . InvalidTestMethodSubclass2TestCase .class )) //
205
206
.build ()) //
206
207
);
207
208
}
@@ -224,16 +225,18 @@ void reportsWarningForInvalidStandaloneTestClass(LauncherDiscoveryRequest reques
224
225
225
226
static List <Arguments > requestsForTestClassWithInvalidStandaloneTestClass () {
226
227
return List .of ( //
227
- argumentSet ("directly selected" , request ().selectors (selectClass (InvalidTestClassTestCase .class )).build (),
228
- InvalidTestClassTestCase .class ), //
228
+ argumentSet ("directly selected" ,
229
+ request ().selectors (selectClass (InvalidTestCases .InvalidTestClassTestCase .class )).build (),
230
+ InvalidTestCases .InvalidTestClassTestCase .class ), //
229
231
argumentSet ("indirectly selected" , request () //
230
- .selectors (selectPackage (InvalidTestClassTestCase .class .getPackageName ())) //
231
- .filters (includeClassNamePatterns (Pattern .quote (InvalidTestClassTestCase .class .getName ()))).build (), //
232
- InvalidTestClassTestCase .class ), //
232
+ .selectors (selectPackage (InvalidTestCases .InvalidTestClassTestCase .class .getPackageName ())) //
233
+ .filters (includeClassNamePatterns (
234
+ Pattern .quote (InvalidTestCases .InvalidTestClassTestCase .class .getName ()))).build (), //
235
+ InvalidTestCases .InvalidTestClassTestCase .class ), //
233
236
argumentSet ("subclass" , request () //
234
- .selectors (selectClass (InvalidTestClassSubclassTestCase .class )) //
237
+ .selectors (selectClass (InvalidTestCases . InvalidTestClassSubclassTestCase .class )) //
235
238
.build (), //
236
- InvalidTestClassSubclassTestCase .class ) //
239
+ InvalidTestCases . InvalidTestClassSubclassTestCase .class ) //
237
240
);
238
241
}
239
242
@@ -247,18 +250,19 @@ void reportsWarningForInvalidNestedTestClass(LauncherDiscoveryRequest request) {
247
250
assertThat (discoveryIssues ).hasSize (2 );
248
251
assertThat (discoveryIssues .getFirst ().message ()) //
249
252
.isEqualTo ("@Nested class '%s' must be an inner class but is static. It will not be executed." ,
250
- InvalidTestClassTestCase .Inner .class .getName ());
253
+ InvalidTestCases . InvalidTestClassTestCase .Inner .class .getName ());
251
254
assertThat (discoveryIssues .getLast ().message ()) //
252
255
.isEqualTo ("@Nested class '%s' must not be private. It will not be executed." ,
253
- InvalidTestClassTestCase .Inner .class .getName ());
256
+ InvalidTestCases . InvalidTestClassTestCase .Inner .class .getName ());
254
257
}
255
258
256
259
static List <Named <LauncherDiscoveryRequest >> requestsForTestClassWithInvalidNestedTestClass () {
257
260
return List .of ( //
258
- named ("directly selected" , request ().selectors (selectClass (InvalidTestClassTestCase .Inner .class )).build ()), //
261
+ named ("directly selected" ,
262
+ request ().selectors (selectClass (InvalidTestCases .InvalidTestClassTestCase .Inner .class )).build ()), //
259
263
named ("subclass" , request () //
260
- .selectors (selectNestedClass (List .of (InvalidTestClassSubclassTestCase .class ),
261
- InvalidTestClassTestCase .Inner .class )) //
264
+ .selectors (selectNestedClass (List .of (InvalidTestCases . InvalidTestClassSubclassTestCase .class ),
265
+ InvalidTestCases . InvalidTestClassTestCase .Inner .class )) //
262
266
.build ()) //
263
267
);
264
268
}
@@ -331,41 +335,45 @@ class ConcreteInner1 extends AbstractSuperClass {
331
335
}
332
336
}
333
337
334
- @ SuppressWarnings ("JUnitMalformedDeclaration" )
335
- static class InvalidTestMethodTestCase {
336
- @ Test
337
- private static int test () {
338
- return fail ("should not be called" );
339
- }
340
- }
341
-
342
- static class InvalidTestMethodSubclass1TestCase extends InvalidTestMethodTestCase {
343
- }
338
+ static class InvalidTestCases {
344
339
345
- static class InvalidTestMethodSubclass2TestCase extends InvalidTestMethodTestCase {
346
- }
340
+ @ SuppressWarnings ("JUnitMalformedDeclaration" )
341
+ static class InvalidTestMethodTestCase {
342
+ @ Test
343
+ private static int test () {
344
+ return fail ("should not be called" );
345
+ }
346
+ }
347
347
348
- @ SuppressWarnings ({ "JUnitMalformedDeclaration" , "InnerClassMayBeStatic" })
349
- private class InvalidTestClassTestCase {
348
+ static class InvalidTestMethodSubclass1TestCase extends InvalidTestMethodTestCase {
349
+ }
350
350
351
- @ SuppressWarnings ("unused" )
352
- @ Test
353
- void test () {
354
- fail ("should not be called" );
351
+ static class InvalidTestMethodSubclass2TestCase extends InvalidTestMethodTestCase {
355
352
}
356
353
357
- @ Nested
358
- private static class Inner {
354
+ @ SuppressWarnings ({ "JUnitMalformedDeclaration" , "InnerClassMayBeStatic" })
355
+ private class InvalidTestClassTestCase {
356
+
359
357
@ SuppressWarnings ("unused" )
360
358
@ Test
361
359
void test () {
362
360
fail ("should not be called" );
363
361
}
362
+
363
+ @ Nested
364
+ private static class Inner {
365
+ @ SuppressWarnings ("unused" )
366
+ @ Test
367
+ void test () {
368
+ fail ("should not be called" );
369
+ }
370
+ }
371
+
364
372
}
365
373
366
- }
374
+ private class InvalidTestClassSubclassTestCase extends InvalidTestClassTestCase {
375
+ }
367
376
368
- private class InvalidTestClassSubclassTestCase extends InvalidTestClassTestCase {
369
377
}
370
378
371
379
}
0 commit comments