[英]Mockito matchers exception 0 matchers expected, 3 !! all recorded records are matchers
I have a Mockito when with matchers我有匹配器时的 Mockito
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.我通过禁用 Hibernate Aspect 解决了这个问题。 it's not a problem of mockito.这不是 mockito 的问题。 when aspect throw an exception, mockito throw matcher exception当方面抛出异常时,mockito 抛出匹配器异常
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.