Question

At the moment I have following code:

val mockXmlRpc = mock[XmlRpcClient]
mockXmlRpc.execute("foo.",Array[Object]()).andReturn("").anyTimes()

During the test execute methid is called few times with different String arrays and I just need to return empty String to all of these calls.

How can I achieve this without writing custom matchers for each call?

Was it helpful?

Solution

Turns out there is a solution to this lurking in EasyMock documentation

mockXmlRpc.execute("foo.", isA(classOf[Array[Object]])).andReturn("").anyTimes()

OTHER TIPS

For a String array, do this:

mockXmlRpc.execute("foo.", EasyMock.anyObject(String[].class)).andReturn(someMockObj);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top