Any wait function argument in easymock scalatest

I just started using scalatest for java code and the fact that we use easymock to create mocks.

I have a situation where I want to do something like this.

expecting{ objA.function(x$1, x$2).andReturn(objectB) } 

For the place owner x $ 1, x $ 2 I want to call a function similar to anyObject() in java.

Please offer something that can replace the placeholder.

+6
source share
1 answer

Using methods available in Mockito (not sure if you are using it):

eg.

 def any[T : ClassTag]: T = org.mockito.Matchers.any(implicitly[ClassTag[T]].runtimeClass).asInstanceOf[T] 

and you can use it as

 val a = mock[Foo] doReturn(fooResult).when(a).fooMethod(any[FooInput]) 
0
source

All Articles