我想在独立模拟模式下测试我的服务层。然后我得到错误 测试类别说明
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {TestContext.class, AppConfig.class, SecurityConfig
.class, LDAPProperties.class, LDAPUserDetailsService.class})
@WebAppConfiguration
@Before
public void setUp(){
MockitoAnnotations.initMocks(this);
Mockito.reset(employeeDao);
mockMvc= MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
}
错误
Wanted but not invoked:
employeeDao.getEmployeeByUId("name.dz");
-> at io.dzone.manager.service.EmployeeServiceImplTest.getEmployeeByUIdTest(EmployeeServiceImplTest.java:80)
Actually, there were zero interactions with this mock.