Reputation: 403
I have a class I am trying to mock with scala mock but I am getting a compilation error. How can I correct this error or specify the implicit correctly?
It says the implicit arg is unspecified.
I tried following the guide on the scala mock site. I have also tried different ways of specifying the implicit value.
I am creating the mock here
val mockUserSessionApiGatewayHandler = mock[UserSessionApiGatewayHandler]
Here is the method signature
def userExists[F[+_] : Monad](request: UserNameAndPasswordEvent)(implicit awsProxy: DatabaseProxy[F, UserTable])
I am specifying the mock here
(mockUserSessionApiGatewayHandler.userExists[IO] (_: UserNameAndPasswordEvent) ( _: DatabaseProxy[IO, UserTable]) )
.expects(testUserNameAndPasswordEvent, *)
.returning(EitherT.rightT[IO, String]("User Does Not Exist"))
Here is the error
not enough arguments for method userExists: (implicit evidence$3: cats.Monad[cats.effect.IO], implicit awsProxy: lambdas.database.DatabaseProxy[cats.effect.IO,lambdas.database.UserTable])cats.data.EitherT[cats.effect.IO,String,String].
[error] Unspecified value parameter awsProxy.
[error] (mockUserSessionApiGatewayHandler.userExists[IO] (_: UserNameAndPasswordEvent) ( _: DatabaseProxy[IO, UserTable]) )
[error] ^
[error] one error found
Upvotes: 1
Views: 187
Reputation: 403
It turns out the generic type was implicit so I need to add that to be expected.
(mockUserSessionApiGatewayHandler.userExists[IO]
(_: UserNameAndPasswordEvent) (_:IO , _: DatabaseProxy[IO, UserTable]) )
.expects(testUserNameAndPasswordEvent, *, *)
Upvotes: 1