@@ -44,6 +44,7 @@ public class JUnitAgent {
4444 * <ul>
4545 * <li>{@code org.junit.runner.Description}</li>
4646 * <li>{@code org.junit.runners.model.FrameworkMethod}</li>
47+ * <li>{@code org.junit.runners.model.TestClass}</li>
4748 * <li>{@code org.junit.internal.runners.model.EachTestNotifier}</li>
4849 * <li>{@code org.junit.internal.runners.model.ReflectiveCallable}</li>
4950 * <li>{@code org.junit.runners.model.RunnerScheduler}</li>
@@ -52,7 +53,7 @@ public class JUnitAgent {
5253 * <li>{@code org.junit.experimental.theories.Theories$TheoryAnchor}</li>
5354 * <li>{@code org.junit.runner.notification.RunNotifier}</li>
5455 * <li>{@code junitparams.internal.ParameterisedTestMethodRunner}</li>
55- * <li>{@code junitparams.internal.ParametrizedDescription }</li>
56+ * <li>{@code junitparams.internal.TestMethod }</li>
5657 * </ul>
5758 *
5859 * @param agentArgs agent options
@@ -110,8 +111,8 @@ public static ClassFileTransformer installTransformer(Instrumentation instrument
110111 final TypeDescription runWithCompleteAssignment = TypePool .Default .ofSystemLoader ().describe ("com.nordstrom.automation.junit.RunWithCompleteAssignment" ).resolve ();
111112 // junitparams.internal.ParameterisedTestMethodRunner
112113 final TypeDescription nextCount = TypePool .Default .ofSystemLoader ().describe ("com.nordstrom.automation.junit.NextCount" ).resolve ();
113- // junitparams.internal.ParametrizedDescription
114- final TypeDescription parameterizedDescription = TypePool .Default .ofSystemLoader ().describe ("com.nordstrom.automation.junit.ParameterizedDescription " ).resolve ();
114+ // junitparams.internal.TestMethod
115+ final TypeDescription testMethodDescription = TypePool .Default .ofSystemLoader ().describe ("com.nordstrom.automation.junit.TestMethodDescription " ).resolve ();
115116
116117 return new AgentBuilder .Default ()
117118 .type (hasSuperType (named ("org.junit.runner.Description" )))
@@ -136,6 +137,15 @@ public DynamicType.Builder<?> transform(DynamicType.Builder<?> builder, TypeDesc
136137 .implement (Hooked .class );
137138 }
138139 })
140+ .type (hasSuperType (named ("org.junit.runners.model.TestClass" )))
141+ .transform (new Transformer () {
142+ @ Override
143+ public DynamicType .Builder <?> transform (DynamicType .Builder <?> builder , TypeDescription typeDescription ,
144+ ClassLoader classLoader , JavaModule module ) {
145+ return builder .implement (FieldsForAnnotationsAccessor .class ).intercept (FieldAccessor .ofField ("fieldsForAnnotations" ))
146+ .implement (Hooked .class );
147+ }
148+ })
139149 .type (hasSuperType (named ("org.junit.internal.runners.model.EachTestNotifier" )))
140150 .transform (new Transformer () {
141151 @ Override
@@ -208,15 +218,16 @@ public DynamicType.Builder<?> transform(DynamicType.Builder<?> builder, TypeDesc
208218 public DynamicType .Builder <?> transform (DynamicType .Builder <?> builder , TypeDescription type ,
209219 ClassLoader classloader , JavaModule module ) {
210220 return builder .method (named ("nextCount" )).intercept (MethodDelegation .to (nextCount ))
221+ .implement (MethodAccessor .class ).intercept (FieldAccessor .ofField ("method" ))
211222 .implement (Hooked .class );
212223 }
213224 })
214- .type (hasSuperType (named ("junitparams.internal.ParametrizedDescription " )))
225+ .type (hasSuperType (named ("junitparams.internal.TestMethod " )))
215226 .transform (new Transformer () {
216227 @ Override
217228 public DynamicType .Builder <?> transform (DynamicType .Builder <?> builder , TypeDescription type ,
218229 ClassLoader classloader , JavaModule module ) {
219- return builder .method (named ("parametrizedDescription " )).intercept (MethodDelegation .to (parameterizedDescription ))
230+ return builder .method (named ("description " )).intercept (MethodDelegation .to (testMethodDescription ))
220231 .implement (Hooked .class );
221232 }
222233 })
0 commit comments