I have method:
get[T](method: String, additionalHeaders: (String,String)*)(block: HttpResponse => Try[T]): Future[T]
I try like this:
var serviceClient = mock[ServiceClient]
(serviceClient .get _).expects(*, *)
But get error:
org.scalamock.function.MockFunction3 cannot be cast to org.scalamock.function.MockFunction2
java.lang.ClassCastException: org.scalamock.function.MockFunction3 cannot be cast to org.scalamock.function.MockFunction2
at .TestSpec.$anonfun$new$1(TestSpec.scala:22)
I just want to return the same object regardless of the parameters
In your case you have curried function with three args:
and calling
getcan be presented as:if we will uncurry
get:and we can use this service to mock
uncurriedGetas function with 3 args:to make your code working you need to make conversion from Curried function to UnCurried and pass types (I use
Stringinstead ofTtype parameter to simplify):It is also needed expand types of arguments to give compiler more information and it will can convert this into function of 3 args.