use of com.palantir.conjure.java.api.errors.UnknownRemoteException in project dialogue by palantir.
the class MyServiceIntegrationTest method testGetGreetingAsyncUnknownRemoteException.
@Test
public void testGetGreetingAsyncUnknownRemoteException() {
String errorBody = "Error";
undertowHandler = exchange -> {
exchange.assertMethod(HttpMethod.GET);
exchange.assertPath("/greeting");
exchange.assertAccept().isEqualTo("text/csv");
exchange.assertContentType().isNull();
exchange.assertNoBody();
exchange.exchange.setStatusCode(500);
exchange.setContentType("text/plain");
exchange.writeStringBody(errorBody);
};
assertThatThrownBy(() -> myServiceDialogue.getGreetingAsync().get()).isExactlyInstanceOf(ExecutionException.class).hasCauseExactlyInstanceOf(UnknownRemoteException.class).satisfies(executionException -> assertThat(((UnknownRemoteException) executionException.getCause()).getBody()).isEqualTo(errorBody));
}
Aggregations