13
如何解决不必要的存根异常
我的代码如下 @RunWith(MockitoJUnitRunner.class) public class MyClass { private static final String code ="Test"; @Mock private MyClassDAO dao; @InjectMocks private MyClassService Service = new MyClassServiceImpl(); @Test public void testDoSearch() throws Exception { final String METHOD_NAME = logger.getName().concat(".testDoSearchEcRcfInspections()"); CriteriaDTO dto = new CriteriaDTO(); dto.setCode(code); inspectionService.searchEcRcfInspections(dto); List<SearchCriteriaDTO> summaryList = new ArrayList<SearchCriteriaDTO>(); inspectionsSummaryList.add(dto); when(dao.doSearch(dto)).thenReturn(inspectionsSummaryList);//got error …