Method threw 'org.mockito.exceptions.misusing.InvalidUseOfMatchersException' exception. Cannot evalu

Method threw 'org.mockito.exceptions.misusing.InvalidUseOfMatchersException' exception. Cannot evaluate XXXDAO$$EnhancerByMockitoWithCGLIB$$30e37a7a.toString()

原因:

List list = new ArrayList<>();

when(dao.test(any(Student.class))).thenReturn(list);

do not mixed matchers and values 

should use one matchers and one values

like this:

Student s = spy(Student.class);

when(dao.test(s)).thenReturn(list);

你可能感兴趣的:(Method threw 'org.mockito.exceptions.misusing.InvalidUseOfMatchersException' exception. Cannot evalu)