Hi,
Is there a way to unit test an advice with JUnit ? I have a problem when I unit test my invoke(MethodInvocation invocation) method, I am not able to create a mock for the object MethodInvocation. Any guess ?
Hi,
Is there a way to unit test an advice with JUnit ? I have a problem when I unit test my invoke(MethodInvocation invocation) method, I am not able to create a mock for the object MethodInvocation. Any guess ?
I would guess creating a proxy object in the unit test would be the easiest approach:
Code:ProxyFactory proxyFactory = new ProxyFactory(myTarget); proxyFactory.addAdvise(myMethodInterceptor); MyInterface proxy = (MyInterface)proxyFactory.getProxy();
yes I am going to work something around that, I don't need any mock, I am just going to use the spring API. Thanks