use of com.canoo.dp.impl.platform.core.http.HttpStatus.SC_HTTP_RESOURCE_NOTFOUND in project dolphin-platform by canoo.
the class HttpClientTests method testBadEndpoint.
@Test
public void testBadEndpoint() throws Exception {
// given:
final HttpClient client = PlatformClient.getService(HttpClient.class);
final AtomicBoolean actionCalled = new AtomicBoolean(false);
final AtomicBoolean doneCalled = new AtomicBoolean(false);
final AtomicBoolean errorCalled = new AtomicBoolean(false);
// when:
final CompletableFuture<HttpResponse<Void>> future = client.get("http://localhost:" + freePort + "/not/available").withoutContent().withoutResult().onDone(response -> {
actionCalled.set(true);
doneCalled.set(true);
}).onError(e -> {
actionCalled.set(true);
errorCalled.set(true);
}).execute();
// then:
assertThatBadResponseException(doneCalled, errorCalled, future, SC_HTTP_RESOURCE_NOTFOUND);
assertThatErrorCalledAndDoneNotCalled(actionCalled, doneCalled, errorCalled);
}
Aggregations