### Question:
HttpAsyncRequestStep extends Step { @Override public NextAction apply(Packet packet) { AsyncProcessing processing = new AsyncProcessing(packet); return doSuspend(processing::process); } private  HttpAsyncRequestStep(HttpRequest request, HttpResponseStep responseStep); static HttpAsyncRequestStep createGetRequest(String url, HttpResponseStep responseStep); static HttpAsyncRequestStep create(HttpRequest request, HttpResponseStep responseStep); HttpAsyncRequestStep withTimeoutSeconds(long timeoutSeconds); @Override NextAction apply(Packet packet);  }### Answer:
@Test public void whenRequestMade_suspendProcessing() { NextAction action = requestStep.apply(packet); assertThat(FiberTestSupport.isSuspendRequested(action), is(true)); }
@Test public void whenResponseReceived_resumeFiber() { final NextAction nextAction = requestStep.apply(packet); receiveResponseBeforeTimeout(nextAction, response); assertThat(fiber.wasResumed(), is(true)); }
@Test public void whenErrorResponseReceived_logMessage() { final NextAction nextAction = requestStep.apply(packet); receiveResponseBeforeTimeout(nextAction, createStub(HttpResponseStub.class, 500)); assertThat(logRecords, containsFine(HTTP_METHOD_FAILED)); }
@Test public void whenResponseReceived_populatePacket() { NextAction nextAction = requestStep.apply(packet); receiveResponseBeforeTimeout(nextAction, response); assertThat(getResponse(), sameInstance(response)); }
@Test public void whenResponseTimesOut_resumeFiber() { consoleMemento.ignoreMessage(HTTP_REQUEST_TIMED_OUT); NextAction nextAction = requestStep.apply(packet); receiveTimeout(nextAction); assertThat(fiber.wasResumed(), is(true)); }
@Test public void whenResponseTimesOut_packetHasNoResponse() { consoleMemento.ignoreMessage(HTTP_REQUEST_TIMED_OUT); HttpResponseStep.addToPacket(packet, response); NextAction nextAction = requestStep.apply(packet); receiveTimeout(nextAction); assertThat(getResponse(), nullValue()); }
@Test public void whenResponseTimesOut_logWarning() { HttpResponseStep.addToPacket(packet, response); NextAction nextAction = requestStep.apply(packet); receiveTimeout(nextAction); assertThat(logRecords, containsFine(HTTP_REQUEST_TIMED_OUT)); }