use of com.spotify.apollo.test.response.ResponseSource in project apollo by spotify.
the class StubClientTest method shouldReturnIterativeReplies.
@Test
public void shouldReturnIterativeReplies() throws Exception {
ResponseWithDelay response1 = ResponseWithDelay.forResponse(Response.forPayload(encodeUtf8("first response")));
ResponseWithDelay response2 = ResponseWithDelay.forResponse(Response.forPayload(encodeUtf8("second response")));
List<ResponseWithDelay> responses = Arrays.asList(response1, response2);
ResponseSource responseSequence = Responses.sequence(responses);
stubClient.respond(responseSequence).to("http://ping");
assertThat(getStringFromPing().toCompletableFuture().get(), is("first response"));
assertThat(getStringFromPing().toCompletableFuture().get(), is("second response"));
}
Aggregations