use of com.github.mjeanroy.junit.servers.utils.builders.OkHttpResponseBuilder in project junit-servers by mjeanroy.
the class OkHttpResponseFactoryTest method it_should_create_http_response.
@Test
void it_should_create_http_response() {
final Response delegate = new OkHttpResponseBuilder().build();
final long duration = 1000L;
final HttpResponse response = OkHttpResponseFactory.of(delegate, duration);
assertThat(response).isNotNull().isExactlyInstanceOf(OkHttpResponse.class);
assertThat(response.getRequestDuration()).isEqualTo(duration);
}
use of com.github.mjeanroy.junit.servers.utils.builders.OkHttpResponseBuilder in project junit-servers by mjeanroy.
the class OkHttpResponseTest method it_should_implement_to_string.
@Test
void it_should_implement_to_string() {
final Response delegate = new OkHttpResponseBuilder().build();
final long duration = 1000L;
final OkHttpResponse response = new OkHttpResponse(delegate.code(), readResponseBody(delegate), delegate.headers(), duration);
assertThat(response.toString()).isEqualTo("OkHttpResponse{" + "duration: 1000, " + "code: 200, " + "body: \"\", " + "headers: []" + "}");
}
use of com.github.mjeanroy.junit.servers.utils.builders.OkHttpResponseBuilder in project junit-servers by mjeanroy.
the class OkHttpResponseTest method it_should_implement_equal_and_hash_code.
@Test
void it_should_implement_equal_and_hash_code() {
final Response red = new OkHttpResponseBuilder().withStatus(200).build();
final Response black = new OkHttpResponseBuilder().withStatus(400).build();
EqualsVerifier.forClass(OkHttpResponse.class).withRedefinedSuperclass().withIgnoredFields("readResponseBodyLock", "_body").withPrefabValues(Response.class, red, black).verify();
}
Aggregations