I'm new with Mockito and I'm dealing with a very strange problem with matchers
def fetchById[T: Format](elasticDetails: ESDetails): F[ESResult[T]]
I have this def for my Elastic search client and the problem start with the generic Format : T that i have there to pass.
.fetchById[JsValue](anyObject[ESDetails])
.returns(IO.pure(ESResult(200, value = Some(fakeResponse)))) ```
org.mockito.exceptions.misusing.InvalidUseOfMatchersException:
Invalid use of argument matchers!
2 matchers expected, 1 recorded:
-> at org.specs2.mock.mockito.MockitoMatchers.anyObject(MockitoMatchers.scala:49)
This exception may occur if matchers are combined with raw values:
//incorrect:
someMethod(anyObject(), "raw String");
When using matchers, all arguments have to be provided by matchers.
For example:
//correct:
someMethod(anyObject(), eq("String by matcher"));```
//This the error for matchers that i'm getting after I run my tests.