User development,
A new message was posted in the thread "Pointcut not executing":
http://community.jboss.org/message/522368#522368
Author : yusef asjana
Profile :
http://community.jboss.org/people/yusefasjana
Message:
--------------------------------------------------------------
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;
}
}
--------------------------------------------------------------
To reply to this message visit the message page:
http://community.jboss.org/message/522368#522368