28
28
import org .junit .jupiter .api .MethodOrderer ;
29
29
import org .junit .jupiter .api .TestInstance ;
30
30
import org .junit .jupiter .api .extension .ExecutionCondition ;
31
+ import org .junit .jupiter .api .extension .Extension ;
31
32
import org .junit .jupiter .api .extension .ExtensionContext ;
33
+ import org .junit .jupiter .api .extension .TestInstantiationAwareExtension ;
32
34
import org .junit .jupiter .api .io .CleanupMode ;
33
35
import org .junit .jupiter .api .io .TempDirFactory ;
34
36
import org .junit .jupiter .api .parallel .ExecutionMode ;
46
48
import org .junit .platform .engine .ExecutionRequest ;
47
49
import org .junit .platform .engine .TestDescriptor ;
48
50
import org .junit .platform .engine .UniqueId ;
51
+ import org .junit .platform .engine .reporting .OutputDirectoryProvider ;
49
52
import org .junit .platform .engine .support .hierarchical .EngineExecutionContext ;
50
53
import org .junit .platform .engine .support .hierarchical .HierarchicalTestEngine ;
51
54
import org .junit .platform .engine .support .hierarchical .ThrowableCollector ;
@@ -60,7 +63,7 @@ public String getId() {
60
63
@ Override
61
64
public TestDescriptor discover (EngineDiscoveryRequest discoveryRequest , UniqueId uniqueId ) {
62
65
JupiterConfiguration configuration = new CachingJupiterConfiguration (
63
- new DefaultJupiterConfiguration ( discoveryRequest .getConfigurationParameters () ) );
66
+ new DefaultJupiterConfiguration ( discoveryRequest .getConfigurationParameters (), discoveryRequest . getOutputDirectoryProvider () ) );
64
67
JupiterEngineDescriptor engineDescriptor = new BytecodeEnhancedEngineDescriptor ( uniqueId , configuration );
65
68
new DiscoverySelectorResolver ().resolveSelectors ( discoveryRequest , engineDescriptor );
66
69
@@ -126,6 +129,7 @@ private void addEnhancementCheck(boolean enhance, String[] testEnhancedClasses,
126
129
descriptor .getTestClass ().getName ()
127
130
),
128
131
descriptor .getTestClass (),
132
+ descriptor ::getEnclosingTestClasses ,
129
133
jc ,
130
134
enhance ,
131
135
testEnhancedClasses
@@ -161,6 +165,7 @@ private void replaceWithEnhanced(Class<?> enhanced, ClassBasedTestDescriptor des
161
165
convertUniqueId ( child .getUniqueId (), enhancementContextId ),
162
166
updated .getTestClass (),
163
167
findMethodReplacement ( updated , testMethod ),
168
+ updated ::getEnclosingTestClasses ,
164
169
configuration
165
170
)
166
171
);
@@ -172,6 +177,7 @@ private void replaceWithEnhanced(Class<?> enhanced, ClassBasedTestDescriptor des
172
177
convertUniqueId ( child .getUniqueId (), enhancementContextId ),
173
178
updated .getTestClass (),
174
179
findMethodReplacement ( updated , testMethod ),
180
+ updated ::getEnclosingTestClasses ,
175
181
configuration
176
182
) );
177
183
}
@@ -249,6 +255,11 @@ private DelegatingJupiterConfiguration(JupiterConfiguration configuration, Objec
249
255
);
250
256
}
251
257
258
+ @ Override
259
+ public Predicate <Class <? extends Extension >> getFilterForAutoDetectedExtensions () {
260
+ return configuration .getFilterForAutoDetectedExtensions ();
261
+ }
262
+
252
263
@ Override
253
264
public Optional <String > getRawConfigurationParameter (String s ) {
254
265
return configuration .getRawConfigurationParameter ( s );
@@ -269,6 +280,11 @@ public boolean isExtensionAutoDetectionEnabled() {
269
280
return configuration .isExtensionAutoDetectionEnabled ();
270
281
}
271
282
283
+ @ Override
284
+ public boolean isThreadDumpOnTimeoutEnabled () {
285
+ return configuration .isThreadDumpOnTimeoutEnabled ();
286
+ }
287
+
272
288
@ Override
273
289
public ExecutionMode getDefaultExecutionMode () {
274
290
return configuration .getDefaultExecutionMode ();
@@ -313,6 +329,16 @@ public CleanupMode getDefaultTempDirCleanupMode() {
313
329
public Supplier <TempDirFactory > getDefaultTempDirFactorySupplier () {
314
330
return configuration .getDefaultTempDirFactorySupplier ();
315
331
}
332
+
333
+ @ Override
334
+ public TestInstantiationAwareExtension .ExtensionContextScope getDefaultTestInstantiationExtensionContextScope () {
335
+ return configuration .getDefaultTestInstantiationExtensionContextScope ();
336
+ }
337
+
338
+ @ Override
339
+ public OutputDirectoryProvider getOutputDirectoryProvider () {
340
+ return configuration .getOutputDirectoryProvider ();
341
+ }
316
342
}
317
343
318
344
private static class DelegatingDisplayNameGenerator implements DisplayNameGenerator {
@@ -335,13 +361,13 @@ private String prefix() {
335
361
}
336
362
337
363
@ Override
338
- public String generateDisplayNameForNestedClass (Class <?> aClass ) {
339
- return prefix () + delegate .generateDisplayNameForNestedClass ( aClass );
364
+ public String generateDisplayNameForNestedClass (List < Class <?>> enclosingInstanceTypes , Class <?> nestedClass ) {
365
+ return prefix () + delegate .generateDisplayNameForNestedClass ( enclosingInstanceTypes , nestedClass );
340
366
}
341
367
342
368
@ Override
343
- public String generateDisplayNameForMethod (Class <?> aClass , Method method ) {
344
- return prefix () + delegate .generateDisplayNameForMethod ( aClass , method );
369
+ public String generateDisplayNameForMethod (List < Class <?>> enclosingInstanceTypes , Class <?> testClass , Method testMethod ) {
370
+ return prefix () + delegate .generateDisplayNameForMethod ( enclosingInstanceTypes , testClass , testMethod );
345
371
}
346
372
}
347
373
@@ -350,12 +376,11 @@ private static class EnhancementWorkedCheckMethodTestDescriptor extends TestMeth
350
376
private final boolean enhanced ;
351
377
private final String [] classes ;
352
378
353
- public EnhancementWorkedCheckMethodTestDescriptor (UniqueId uniqueId , Class <?> testClass ,
354
- JupiterConfiguration configuration ,
355
- boolean enhanced , String [] classes ) {
379
+ public EnhancementWorkedCheckMethodTestDescriptor (UniqueId uniqueId , Class <?> testClass , Supplier <List <Class <?>>> enclosingInstanceTypes , JupiterConfiguration configuration , boolean enhanced , String [] classes ) {
356
380
super (
357
381
prepareId ( uniqueId , testMethod ( enhanced ) ),
358
382
testClass , testMethod ( enhanced ),
383
+ enclosingInstanceTypes ,
359
384
configuration
360
385
);
361
386
this .enhanced = enhanced ;
0 commit comments