I'm attempting to write a test case utilizing an AbstractFutureStub and am running into an issue chaining multiple responses. Basically all calls to the future stub return the initial response and never the 'next' response:
But the exact same test using an AbstractBlockingStub works as expected, where the first call to create returns the first response, and the second call to create returns the second response. Is it expected that we should be able to mock sequential responses with a AbstractFutureStub?
In my app I will be firing off many requests in parallel and I'd like to get unique responses for each request, but not sure how to simulate this. Note that if I move the fut1.get() above the second stub.create() it works as expected... but this is not how my app will be calling the stub so it would not be an accurate test. The below test works as expected since I presume it's more similar to a blocking stub.
Closing this as I almost immediately discovered how to get it to work: specify unique .withRequest(expectedRequest1) in my stubs, so that each request only matches 1 possible stubbed response.
I'm attempting to write a test case utilizing an
AbstractFutureStub
and am running into an issue chaining multiple responses. Basically all calls to the future stub return the initial response and never the 'next' response:But the exact same test using an
AbstractBlockingStub
works as expected, where the first call tocreate
returns the first response, and the second call tocreate
returns the second response. Is it expected that we should be able to mock sequential responses with aAbstractFutureStub
?In my app I will be firing off many requests in parallel and I'd like to get unique responses for each request, but not sure how to simulate this. Note that if I move the
fut1.get()
above the secondstub.create()
it works as expected... but this is not how my app will be calling the stub so it would not be an accurate test. The below test works as expected since I presume it's more similar to a blocking stub.