Reputation:
How to mock a polymorphic method with an implicit type tag parameter
val mockInterface = mock[SampleInterface]
trait SampleInterface {
def fetchType[M <: Model : TypeTag]: Future[Unit]
}
Upvotes: 0
Views: 403
Reputation:
(mockInterface.fetchType[SampleModel](_: TypeTag[SampleModel]))
.expects(typeTag[SampleMode])
.returning(Future.successful())
Upvotes: 1