I've got following problem. Ive got method
def foo(i: Int)(using String): IO[Unit] = ???
when try this it compiles:
when(myClass.foo(any[Int]())).thenReturn(IO.unit)
but it fails at runtime with the message:
2 matchers expected, 1 recorded
When I add explicit matcher:
when(myClass.foo(any[Int]())(any[String]())).thenReturn(IO.unit)
I've got following compilation error:
method foo in class MyClass does not take more parameters
Has anyone had similar issue and solved it?
I've got following problem. Ive got method
def foo(i: Int)(using String): IO[Unit] = ???
when try this it compiles:
when(myClass.foo(any[Int]())).thenReturn(IO.unit)
but it fails at runtime with the message:
2 matchers expected, 1 recorded
When I add explicit matcher:
when(myClass.foo(any[Int]())(any[String]())).thenReturn(IO.unit)
I've got following compilation error:
method foo in class MyClass does not take more parameters
Has anyone had similar issue and solved it?
Share Improve this question edited Mar 20 at 9:27 fr3ak asked Mar 20 at 9:15 fr3akfr3ak 5133 silver badges17 bronze badges 1- 1 Which version of Scala and which libraries to integrate Mockito in Scala are you using? – Gaël J Commented Mar 20 at 18:11
1 Answer
Reset to default 3With Scala 3.6.4 and ScalaTest+Mockito 3.2.19.0, the following works:
when(myClass.foo(any[Int]())(using any[String]())).thenReturn(IO.unit)