// TODO handle error messages
throw new HttpException(request.url().toString(), request.code());
- } catch (HttpException e) {
- throw e;
-
} catch (HttpRequest.HttpRequestException e) {
- throw new IllegalStateException(e.getCause());
+ throw new IllegalStateException("Fail to request " + request.url(), e.getCause());
}
}
fail();
} catch (Exception e) {
assertThat(e).isInstanceOf(IllegalStateException.class);
- assertThat(e).hasMessage("java.net.ConnectException: Connection refused");
+ assertThat(e).hasMessage("Fail to request http://localhost:1/api/issues");
+ assertThat(e.getCause()).hasMessage("Connection refused");
+
}
}
}
@Test
- public void should_encore_characters() {
+ public void should_encode_characters() {
HttpRequestFactory requestFactory = new HttpRequestFactory(httpServer.url());
httpServer.doReturnBody("{\"issues\": [{\"key\": \"ABCDE\"}]}");