I am trying to use mockito to mock a method. However the class I am injecting mocks with calls the method twice while sending in two different objects of the same type, but depending the values in the object determine the output of the method.
So, for example, If I am trying to mock
public ArrayList<example> attemptToMock(testObject testing)
Lets sat type testObject
has a string value in it.
So if the string value in testObject is "OK" then attemptToMock
should output an array of two objects in it. If testObject
string value is "NO" then the Array list sent out only has one Object.
How to I write a test to handle a call so that a class can call attemptToMock
twice, within the same method, and I can mock out its output it so depending on the values within testObject
. I can mock it to send out different arrays.