Search in sources :

Example 1 with AsyncHttpResponseBuilder

use of com.github.mjeanroy.junit.servers.utils.builders.AsyncHttpResponseBuilder in project junit-servers by mjeanroy.

the class AsyncHttpResponseFactoryTest method it_should_create_http_response.

@Test
void it_should_create_http_response() {
    Response delegate = new AsyncHttpResponseBuilder().build();
    long duration = 1000L;
    HttpResponse response = AsyncHttpResponseFactory.of(delegate, duration);
    assertThat(response).isNotNull().isExactlyInstanceOf(AsyncHttpResponse.class);
    assertThat(response.getRequestDuration()).isEqualTo(duration);
}
Also used : Response(org.asynchttpclient.Response) HttpResponse(com.github.mjeanroy.junit.servers.client.HttpResponse) AsyncHttpResponseBuilder(com.github.mjeanroy.junit.servers.utils.builders.AsyncHttpResponseBuilder) HttpResponse(com.github.mjeanroy.junit.servers.client.HttpResponse) Test(org.junit.jupiter.api.Test)

Example 2 with AsyncHttpResponseBuilder

use of com.github.mjeanroy.junit.servers.utils.builders.AsyncHttpResponseBuilder in project junit-servers by mjeanroy.

the class AsyncHttpResponseTest method it_should_implement_to_string.

@Test
void it_should_implement_to_string() {
    final Response delegate = new AsyncHttpResponseBuilder().build();
    final long duration = 1000L;
    final AsyncHttpResponse response = new AsyncHttpResponse(delegate, duration);
    assertThat(response.toString()).isEqualTo("AsyncHttpResponse{" + "duration: 1000, " + "response: NettyResponse {\n" + "	statusCode=200\n" + "	headers=\n" + "	body=\n" + "\n" + "}" + "}");
}
Also used : Response(org.asynchttpclient.Response) AsyncHttpResponseBuilder(com.github.mjeanroy.junit.servers.utils.builders.AsyncHttpResponseBuilder) Test(org.junit.jupiter.api.Test) AbstractHttpResponseImplTest(com.github.mjeanroy.junit.servers.client.impl.AbstractHttpResponseImplTest)

Aggregations

AsyncHttpResponseBuilder (com.github.mjeanroy.junit.servers.utils.builders.AsyncHttpResponseBuilder)2 Response (org.asynchttpclient.Response)2 Test (org.junit.jupiter.api.Test)2 HttpResponse (com.github.mjeanroy.junit.servers.client.HttpResponse)1 AbstractHttpResponseImplTest (com.github.mjeanroy.junit.servers.client.impl.AbstractHttpResponseImplTest)1