gpt4 book ai didi

java - Mockito 匹配器异常 0 个匹配器预期,3!所有记录的记录都是匹配器

转载 作者:行者123 更新时间:2023-11-30 07:08:30 26 4
gpt4 key购买 nike

与匹配器一起使用时,我有一个 Mockito

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

所以在我运行测试后,出现此异常

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

如果我混合匹配器和实际值,则可能会出现所描述的异常,但我的情况并非如此。

最佳答案

已在评论中解决:

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

关于java - Mockito 匹配器异常 0 个匹配器预期,3!所有记录的记录都是匹配器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39618848/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com