Slick Scala Mockito dao嘲笑

时间:2016-11-23 15:05:53

标签: scala testing mockito slick

我有dao的基本特征:

trait BaseDao[T, A] {
  ...
  def deleteByFilter[C: CanBeQueryCondition](f: T => C): Future[Int]
}

我希望能够嘲笑这种方法。 也许有点像这样:

val someMock = mock[BaseDao[EntityTable, Entity]]
someMock.deleteByFilter(anyFunction1[Posts, Rep[Boolean]].apply) returns Future(1)
// or
someMock.deleteByFilter(anyFunction1[Posts, Rep[Boolean]]) returns Future(1)

但是没有遇到我总是得到的:

[info]   org.mockito.exceptions.misusing.InvalidUseOfMatchersException: Invalid use of argument matchers!
[info] 2 matchers expected, 1 recorded:
[info] -> at org.specs2.mock.mockito.ArgThat$class.anArgThat(ArgThat.scala:11)

如何成功存根此方法?

0 个答案:

没有答案