You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by swathi yakkali <ya...@gmail.com> on 2015/04/13 14:12:12 UTC
Unable to Mock behavior using Mockito for testing Struts2 action
class method
Hi,
I am writing a test case extending from strutsspringtestcase and invoking
the actions as below:
ActionProxy proxy = getActionProxy("/login");
LoginAction action = (LoginAction) proxy.getAction();
String result = proxy.execute();
Also, I am creating mocked objects using mockito as below:
@Mock
DepenencyClass mockedObject;
@Before
public void setUp() throws Exception{
super.setUp();
when(mockedObject.Method1()).thenReturn(result);
}
My expectation is that the action should hit mocked method instead of the
original method. I do understand there is certainly a gap in my
understanding but any help shall be appreciated.
Thanks!!