How to stub a method call with an implicit matcher in Mockito and Scala
问题 My application code uses AService trait AService { def registerNewUser (username: String)(implicit tenant: Tenant): Future[Response] } to register a new user. Class Tenant is a simple case class: case class Tenant(val vstNumber:String, val divisionNumber:String) Trait AServiceMock mimics the registration logic by using a mocked version of AService trait AServiceMock { def registrationService = { val service = mock[AService] service.registerNewUser(anyString) returns Future(fixedResponse)