寻找类似的东西:
//Mockito when rawData.filter(filter) thenReturn mockInfo
//this won't work because the parameter can only match one instance
//but I want
Mockito when rawDataRDD.filter(*) thenReturn mockInfo
那么如何在Scala测试中将spied调用与wildcard匹配?
更多解释:
我正在寻找scala test
中的间谍模拟,其中将捕获所有调用RDD过滤器并返回指定的模拟结果。
更一般地说,在Scala中寻找匹配函数(就像java中的AnyString
),像anyFunction一样匹配所有过滤函数。
答案 0 :(得分:1)
使用Matchers.any()
Mockito when rawDataRDD.filter(Matchers.any()) thenReturn mockInfo