Hello David
Thanks very much for your reply, sorry for the late response.
Firstly, I'd call the integration testing, not unit testing: unit testing wouldn't involve any interceptors.
I would still call this unit test as I am trying to test actions mocking service layer.
Under what circumstances would you *not* want to test a given action with an interceptor that would be applied to that action in the deployed application? If you're going to integration test an action then it should be integrated realistically, otherwise what's the point?
Agree,but I was trying to test an action which is unrelated to the application (just using service layer, so hence mocking) and as interceptor was causing concern I was thinking is there any way to escape the interceptor without changing its code.
If an action shouldn't have an interceptor applied to it that should be handled at the configuration level. If you want to test an action in isolation with no interceptors, then just instantiate it directly and call its methods directly.
What is the reason we have to use actionproxy to test an action even though class under test is an action. As you said we can directly call an action class methods there by avoiding interceptors. But i was curious to find out why then we have to get an action proxy, invocation context and the rest as all the action related test examples shown in struts 2 was using them?