|
19 | 19 | import com.nordstrom.common.file.PathUtils.ReportsDirectory; |
20 | 20 |
|
21 | 21 | import net.bytebuddy.agent.builder.AgentBuilder; |
22 | | -import net.bytebuddy.description.method.MethodDescription; |
23 | 22 | import net.bytebuddy.description.method.MethodDescription.SignatureToken; |
24 | 23 | import net.bytebuddy.description.type.TypeDescription; |
25 | 24 | import net.bytebuddy.implementation.MethodDelegation; |
@@ -74,17 +73,20 @@ public static ClassFileTransformer installTransformer(Instrumentation instrument |
74 | 73 | SignatureToken runToken = new SignatureToken("run", TypeDescription.VOID, Arrays.asList(runNotifier)); |
75 | 74 |
|
76 | 75 | return new AgentBuilder.Default() |
77 | | - .type(hasSuperType(named("org.junit.internal.runners.model.ReflectiveCallable")) |
78 | | - .or(hasSuperType(named("org.junit.runners.model.RunnerScheduler"))) |
79 | | - .or(hasSuperType(named("org.junit.runners.BlockJUnit4ClassRunner"))) |
80 | | - .or(hasSuperType(named("org.junit.runners.ParentRunner")))) |
| 76 | + .type(hasSuperType(named("org.junit.internal.runners.model.ReflectiveCallable"))) |
81 | 77 | .transform((builder, type, classLoader, module) -> |
82 | 78 | builder.method(named("runReflectiveCall")).intercept(MethodDelegation.to(runReflectiveCall)) |
83 | | - .method(named("finished")).intercept(MethodDelegation.to(finished)) |
84 | | - .method(named("createTest")).intercept(MethodDelegation.to(createTest)) |
| 79 | + .implement(Hooked.class)) |
| 80 | + .type(hasSuperType(named("org.junit.runners.model.RunnerScheduler"))) |
| 81 | + .transform((builder, type, classLoader, module) -> |
| 82 | + builder.method(named("finished")).intercept(MethodDelegation.to(finished)) |
| 83 | + .implement(Hooked.class)) |
| 84 | + .type(hasSuperType(named("org.junit.runners.ParentRunner"))) |
| 85 | + .transform((builder, type, classLoader, module) -> |
| 86 | + builder.method(named("createTest")).intercept(MethodDelegation.to(createTest)) |
85 | 87 | .method(named("runChild")).intercept(MethodDelegation.to(runChild)) |
86 | 88 | .method(hasSignature(runToken)).intercept(MethodDelegation.to(run)) |
87 | | - .implement(Hooked.class)) |
| 89 | + .implement(Hooked.class)) |
88 | 90 | .installOn(instrumentation); |
89 | 91 | } |
90 | 92 |
|
|
0 commit comments