If I create a mock like this
when(servicesTestEnv.mockUserProfileAndPortfolioTransactionRepository.get(servicesTestEnv.mockDistributedTransaction,ArgumentMatchers.any[ExternalUserProfileKeys]))
.thenReturn(Right(servicesTestEnv.externalUserProfile))
I get error
Invalid use of argument matchers! 2 matchers expected, 1 recorded: -> at UnitSpecs.ServiceSpecs.UserTransactionDatabaseServiceSpecs.$anonfun$new$17(UserTransactionDatabaseServiceSpecs.scala:170)
But if I replace both with value
when(servicesTestEnv.mockUserProfileAndPortfolioTransactionRepository.get(servicesTestEnv.mockDistributedTransaction,keys))
.thenReturn(Right(servicesTestEnv.externalUserProfile))
or
when(servicesTestEnv.mockUserProfileAndPortfolioTransactionRepository.get(ArgumentMatchers.any[DistributedTransaction],ArgumentMatchers.any[ExternalUserProfileKeys]))
.thenReturn(Right(servicesTestEnv.externalUserProfile))
then I don't get the error
Is this a rule in Mockito that all argument either need to matchers or values?