struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swathi yakkali <yakkaliswa...@gmail.com>
Subject Unable to Mock behavior using Mockito for testing Struts2 action class method
Date Mon, 13 Apr 2015 12:12:12 GMT
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!!

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message