Hi, one of my pointcuts is not executing
execution(* com.test.Engine->getInstance(..))
I'm using the @Replace and MockAspect classes to mock some objects on my junit, one of the methods that I need to mock is the getInstance method on the Engine class. and whenever the method that I'm trying to mock references the class(eg.Engine) on it's signature the callback doesn't execute, then if i change the callback signature to return and Object everything works.
package com.test;
public class Engine {
public String name;
public String getResponse(String name)
{
return name;
}
public Engine()
{
System.out.println("CLASS");
}
public String retro()
{
return "Test2";
}
public static Engine getInstance()
{
Engine t = new Engine();
t.name="test";
return t;
}
}
public class BatchTest extends BaseTestCase{
@Test
@Replace(invocation = "com.test.Engine->getInstance(..)",
callbackClass = "BatchTest",
callbackMethod = "test")
public void executeTest() throws Exception
{
Engine engine = new Engine();
System.out.println(Engine.getInstance(new Batch()).name);
}
public Engine test()
{
Engine t = new Engine();
t.name="test3";
return t;
}
}