1111
1212import org .junit .runners .model .RunnerScheduler ;
1313import org .junit .runners .model .TestClass ;
14+ import org .slf4j .Logger ;
15+ import org .slf4j .LoggerFactory ;
1416
1517import net .bytebuddy .implementation .bind .annotation .SuperCall ;
1618import net .bytebuddy .implementation .bind .annotation .This ;
2224@ SuppressWarnings ("squid:S1118" )
2325public class CreateTestClass {
2426 private static final ServiceLoader <TestClassWatcher > classWatcherLoader ;
27+ private static final Logger LOGGER = LoggerFactory .getLogger (CreateTestClass .class );
2528 private static final Map <TestClass , Object > TESTCLASS_TO_RUNNER = new ConcurrentHashMap <>();
2629
2730 static {
@@ -38,6 +41,7 @@ public class CreateTestClass {
3841 */
3942 public static TestClass intercept (@ This final Object runner , @ SuperCall final Callable <?> proxy )
4043 throws Exception {
44+
4145 TestClass testClass = (TestClass ) proxy .call ();
4246 TESTCLASS_TO_RUNNER .put (testClass , runner );
4347
@@ -58,20 +62,20 @@ public static TestClass intercept(@This final Object runner, @SuperCall final Ca
5862 private static void attachRunnerScheduler (final TestClass testClass , final Object runner ) {
5963 try {
6064 RunnerScheduler scheduler = getFieldValue (runner , "scheduler" );
61- setFieldValue (runner , "scheduler" , createRunnerScheduler (testClass , runner , scheduler ));
65+ setFieldValue (runner , "scheduler" , createRunnerScheduler (testClass , scheduler ));
6266 } catch (IllegalAccessException | NoSuchFieldException | SecurityException | IllegalArgumentException e ) {
67+ LOGGER .warn ("Unable to attach notifying runner scheduler" , e );
6368 }
6469 }
6570
6671 /**
67- * Create lifecycle-reporting runner scheduler, which forwards to the previous scheduler if specified.
72+ * Create notifying runner scheduler, which forwards to the previous scheduler if specified.
6873 *
6974 * @param testClass {@link TestClass} object that was just created
70- * @param runner {@link ParentRunner} for the specified test class
7175 * @param scheduler runner scheduler that's currently attached to the specified runner (may be {@code null})
72- * @return new lifecycle-reporting runner scheduler
76+ * @return new notifying runner scheduler
7377 */
74- private static RunnerScheduler createRunnerScheduler (final TestClass testClass , final Object runner , final RunnerScheduler scheduler ) {
78+ private static RunnerScheduler createRunnerScheduler (final TestClass testClass , final RunnerScheduler scheduler ) {
7579 return new RunnerScheduler () {
7680 private AtomicBoolean scheduled = new AtomicBoolean (false );
7781
0 commit comments