简体   繁体   中英

Mockito matchers exception 0 matchers expected, 3 !! all recorded records are matchers

I have a Mockito when with matchers

Mockito.when(aRepository.searchForList(
    Mockito.any(LocalDateTime.class),
    Mockito.anyLong(), 
    Mockito.anyBoolean()
)).thenReturn(mockedSearchForList);

so after i run tests, have this exception

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: 
Invalid use of argument matchers!
0 matchers expected, 3 recorded:

Described exception may occur if I mix matchers and real values, which is not my case.

Resolved in the comments:

I solve this issue, by disabling Hibernate Aspect. it's not a problem of mockito. when aspect throw an exception, mockito throw matcher exception

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM