use of com.tvd12.ezyhttp.client.request.PostRequest in project ezyhttp by youngmonkeys.
the class HttpClientProxyTest method clientWasNotActive.
@Test
public void clientWasNotActive() {
// given
HttpClientProxy sut = HttpClientProxy.builder().build();
PostRequest request = new PostRequest().setConnectTimeout(15000).setEntity(String.class).setResponseType(TestResponse.class).setResponseType(StatusCodes.OK, TestResponse.class).setURL("http://127.0.0.1:18081/greet");
// when
Throwable e = Asserts.assertThrows(() -> sut.call(request, 150000));
// then
Asserts.assertThat(e).isEqualsType(ClientNotActiveException.class);
sut.close();
sut.stop();
}
use of com.tvd12.ezyhttp.client.request.PostRequest in project ezyhttp by youngmonkeys.
the class HttpClientTest method postMethodNotAllow.
@Test
public void postMethodNotAllow() {
// given
HttpClient sut = HttpClient.builder().build();
PostRequest request = new PostRequest().setResponseType(TestResponse.class).setResponseType(StatusCodes.OK, TestResponse.class).setURL(URI.create("http://127.0.0.1:18081/405"));
// when
Throwable e = Asserts.assertThrows(() -> sut.call(request));
// then
Asserts.assertThat(e).isEqualsType(HttpMethodNotAllowedException.class);
}
use of com.tvd12.ezyhttp.client.request.PostRequest in project ezyhttp by youngmonkeys.
the class HttpClientTest method postMethodNotFound.
@Test
public void postMethodNotFound() {
// given
HttpClient sut = HttpClient.builder().build();
PostRequest request = new PostRequest().setResponseType(TestResponse.class).setResponseType(StatusCodes.OK, TestResponse.class).setURL(URI.create("http://127.0.0.1:18081/404"));
// when
Throwable e = Asserts.assertThrows(() -> sut.call(request));
// then
Asserts.assertThat(e).isEqualsType(HttpNotFoundException.class);
}
use of com.tvd12.ezyhttp.client.request.PostRequest in project ezyhttp by youngmonkeys.
the class HttpClientTest method postMethodConflict.
@Test
public void postMethodConflict() {
// given
HttpClient sut = HttpClient.builder().build();
PostRequest request = new PostRequest().setResponseType(TestResponse.class).setResponseType(StatusCodes.OK, TestResponse.class).setURL(URI.create("http://127.0.0.1:18081/409"));
// when
Throwable e = Asserts.assertThrows(() -> sut.call(request));
// then
Asserts.assertThat(e).isEqualsType(HttpConflictException.class);
}
use of com.tvd12.ezyhttp.client.request.PostRequest in project ezyhttp by youngmonkeys.
the class HttpClientTest method postMethodServer501.
@Test
public void postMethodServer501() {
// given
HttpClient sut = HttpClient.builder().build();
PostRequest request = new PostRequest().setResponseType(TestResponse.class).setResponseType(StatusCodes.OK, TestResponse.class).setURL(URI.create("http://127.0.0.1:18081/501"));
// when
Throwable e = Asserts.assertThrows(() -> sut.call(request));
// then
Asserts.assertThat(e).isEqualsType(HttpRequestException.class);
}
Aggregations