recoverer.recoverPayloads(
EasyMock.eq(obj), EasyMock.eq(nextExpectedVersion - 1), EasyMock.anyObject(Callback.class));
EasyMock.expectLastCall().andAnswer(new IAnswer<Void>() {
@Override
public Void answer() throws Throwable {
Callback callback = (Callback) EasyMock.getCurrentArguments()[2];
JsonArray<RecoveredPayload> recoveredPayloads = JsonCollections.createArray();
for (int i = nextExpectedVersion; i < nextExpectedVersion + payloadCount; i++) {
recoveredPayloads.add(new StubRecoveredPayload(i, PAYLOADS.get(i)));
}
callback.onPayloadsRecovered(recoveredPayloads, nextExpectedVersion);
return null;
}
});
}