Mockito to verify variable arguments

23 May 2013

Let's say you have a method's signature that looks like this:

def select[A](query: String, params: Any*)(f: ResultSet => A): Future[Seq[A]]

When you would like to verify it with a mix of `any` and values, you will need to do this:

import org.mockito.Matchers.{eq => meq, _} there was one(db).select(any[String], meq(Seq(1, 2, 3))(any[ResultSet => Category])

That would be corresponding to the invocation of `"Something", 1, 2, 3)(someFunc)`

Give it a kudos