mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-22 14:09:25 +00:00
Simplify tests
This commit is contained in:
+4
-2
@@ -406,8 +406,10 @@ class RestClientIntegrationTests {
|
||||
}
|
||||
catch (HttpServerErrorException ex) {
|
||||
assertThat(ex.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
assumeFalse(requestFactory instanceof JdkClientHttpRequestFactory, "JDK HttpClient does not expose status text");
|
||||
assertThat(ex.getStatusText()).isEqualTo("Server Error");
|
||||
// JDK HttpClient does not expose status text
|
||||
if (!(requestFactory instanceof JdkClientHttpRequestFactory)) {
|
||||
assertThat(ex.getStatusText()).isEqualTo("Server Error");
|
||||
}
|
||||
assertThat(ex.getResponseHeaders().getContentType()).isEqualTo(MediaType.TEXT_PLAIN);
|
||||
assertThat(ex.getResponseBodyAsString()).isEqualTo(errorMessage);
|
||||
}
|
||||
|
||||
+4
-2
@@ -248,8 +248,10 @@ class RestTemplateIntegrationTests extends AbstractMockWebServerTests {
|
||||
assertThat(ex.getStatusText()).isNotNull();
|
||||
assertThat(ex.getResponseBodyAsString()).isNotNull();
|
||||
assertThat(ex.getMessage()).containsSubsequence("404", "on GET request for \"" + url + "\": [no body]");
|
||||
assumeFalse(clientHttpRequestFactory instanceof JdkClientHttpRequestFactory, "JDK HttpClient does not expose status text");
|
||||
assertThat(ex.getMessage()).isEqualTo("404 Client Error on GET request for \"" + url + "\": [no body]");
|
||||
// JDK HttpClient does not expose status text
|
||||
if (!(clientHttpRequestFactory instanceof JdkClientHttpRequestFactory)) {
|
||||
assertThat(ex.getMessage()).isEqualTo("404 Client Error on GET request for \"" + url + "\": [no body]");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user