Search in sources :

Example 1 with NingHttpResponseBuilder

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

the class NingAsyncHttpResponseFactoryTest method it_should_create_http_response.

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

Example 2 with NingHttpResponseBuilder

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

the class NingAsyncHttpResponseTest method it_should_implement_to_string.

@Test
void it_should_implement_to_string() {
    final Response delegate = new NingHttpResponseBuilder().build();
    final long duration = 1000L;
    final NingAsyncHttpResponse response = new NingAsyncHttpResponse(delegate, duration);
    assertThat(response.toString()).isEqualTo("NingAsyncHttpResponse{" + "duration: 1000, " + "response: " + delegate.toString() + "}");
}
Also used : Response(com.ning.http.client.Response) NingHttpResponseBuilder(com.github.mjeanroy.junit.servers.utils.builders.NingHttpResponseBuilder) Test(org.junit.jupiter.api.Test) AbstractHttpResponseImplTest(com.github.mjeanroy.junit.servers.client.impl.AbstractHttpResponseImplTest)

Aggregations

NingHttpResponseBuilder (com.github.mjeanroy.junit.servers.utils.builders.NingHttpResponseBuilder)2 Response (com.ning.http.client.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