在specs2中,我可以通过以下方式验证方法的调用时间:
there was one(user).getName
there were two(user).getName
there were three(user).getName但是如何检查N次呢?我正在寻找的东西是:
there were times(n, user).getName不幸的是,没有这样的API
发布于 2014-10-12 12:36:43
这是一个遗漏。我刚刚将exactly添加到API中,并将其发布为specs2-mock-2.4.7-SNAPSHOT (官方版本很快就会发布):
val list2 = mock[java.util.List[String]]
1 to 2 foreach { i => list.add("one") }
there was exactly(2)(list).add("one")https://stackoverflow.com/questions/26303624
复制相似问题