Mock a method without arguments but with implicit parameters
You didn't look at the right example, I guess. Look at example 4 for implicit parameters:
class Codec()
trait Memcached {
def get(key: String)(implicit codec: Codec): Option[Int]
}
val memcachedMock = mock[Memcached]
implicit val codec = new Codec
(memcachedMock.get(_ : String)(_ : Codec)).expects("some_key", *).returning(Some(123))
In your case, of course, the non-implicit params are null, so you want:
(m.getResult()(_: ExecutionContext)).expects(*) returning "..."
Just to complete the cases. If someone tries to do the same with more params the snippet is the following:
trait MemcachedV2 {
def get(key: String, value: String)(implicit codec: Codec): Option[Int]
}
val memcachedMock2 = mock[MemcachedV2]
(memcachedMock2.get(_, _)(_))
.expects("some_key","another value", *)
.returning(Some(123))