我的测试中有以下代码...
val list : List[MyClass] = List(new MyClass)
...
doNothing().when(localLib).handleDelete(anyString(), anyString(), anyInt(), eq(list))
Run Code Online (Sandbox Code Playgroud)
这会引发以下编译异常
Error:(890, 83) type mismatch;
found : Boolean
required: java.util.List[my.package.MyClass]
doNothing().when(localLib).handleDelete(anyString(), anyString(), anyInt(), eq(list))
^
Run Code Online (Sandbox Code Playgroud)
你一定在用scalatest?与 存在冲突Mockito,其中一个*Spec特征定义了自己的eq,最终您将引用该特征而不是Mockito匹配器。
尝试添加显式导入:import org.mockito.ArgumentMatchers.{ eq => mockitoEq }
然后在需要匹配器时使用mockitoEq而不是。eq
| 归档时间: |
|
| 查看次数: |
2032 次 |
| 最近记录: |