I have a factory interface B which returns objects of type A. Type A is also an interface.
I am having trouble figuring out how I can define method behavior for A.doSomething() in my mocks, because every time the factory returns a new instance of A, it needs to know how to doSomething().
This is what I have so far for mocking the factory, however A doesn't know how to doSomething().
when(B.getObject()).thenReturn(Mockito.mock(A.class));
Is there some sort of way I can define A.doSomething() for all instances of A which will be returned?
Any help is greatly appreciated.