-
New Feature
-
Resolution: Unresolved
-
Normal
-
None
-
1.2.0
-
None
For example,i let zats to load zats-web/web.xml whose spring config is mock-beans.xml like this:
<bean id="xxxService" class="org.mockito.Mockito" factory-method="mock"> <constructor-arg value="com.xxx.life.service.XxxCancelService" /> </bean>
and i want to control the xxxService's behavior in my zats tests,
but i found that ,i can not get the same xxxService instance in jetty ServletContext.
And i simply decompile the EmulatorClient.java and add
public Emulator getEmulator() { return emulator; }
and in zats tests :
EmulatorClient client = (EmulatorClient) env.newClient();
WebApplicationContext wac = WebApplicationContextUtils
.getWebApplicationContext(client.getEmulator().getServletContext());
XxxCancelService xxxCancelService=(XxxCancelService) wac.getBean("xxxCancelService");
Mockito.when(xxxCancelService.getXxList(Mockito.anyMap(),Mockito.anyString())).thenReturn(policyList);