Hi,
I'm trying to test an algorithm with Easymock but I'm stumbling into the details of the implementation of this algorithm. Someone who can provide me a way out? The part which gives me a problem is this:
interface A {
B getB ();
}
interface B {
void setX (int x);
void doSomething ();
}
Now somewhere during the algorithm under test this happens:
a.getB ().setX (9);
a.getB ().doSomething ();
a.getB ().setX (16);
This results in an unexpected method call getB () as my test only declares the interesting part:
B b = EasyMock.createStrictControl ();
b.setX (9);
EasyMock.expectLastCall();
b.doSomething ();
EasyMock.expectLastCall();
I understand this is because the order is checked. But even when I place the following line nothing changes.
EasyMock.expect (a.getB ()).andReturn (b).anyTimes ();
The instance a is also an EasyMock proxy.
Anyone who can help me out?