I am wondering what to do to take a deeper insight into the execution flow when running a test unit.
For example, below should be a body of a test unit.
A.methodA(1,2,false);
B b = new B("foo");
boolean c = b.testFoo("abc",true);
Below bodies are found by JVM on classpath.
What I want to ask is, the bytecode of test unit is the only bytecode passed to ASM transformer, in this scenario, can I modify the bytecode of class A and class B?
below should be the body of A
Class A{
public static methodA(int a,int b, boolean c){
if(c) System.out.println(a+b);
else System.out.println(a-b);
}
}
below should be the body of B
Class B
{
String n;
public B(String c) {this.n = c;}
public boolean testFoo(String temp,boolean b)
{
boolean tested = temp.equals(this.n);
return tested.equals(b);
}
}
When I pass the bytecode of test unit to the ASM transformer, can it be able to modify the bytecode of Class A and Class B?