Currently WebTestClient has the ability to display request / responses without regard to a failure. However, it would be nice if there was a way to do this if the assertions fail. For example, the following would include the request / response in the exception.
The following would also include the request / response in the assertion (possibly with a new assertion exception that contains the original exception as a caused by)
webTestClient.get()
.uri("/users")
.exchange()
.andAssert( info -> {
assertThat(info.getResponse().statusCode()).isEqualTo(HttpStatus.OK);
});
Rob Winch opened SPR-15249 and commented
Currently WebTestClient has the ability to display request / responses without regard to a failure. However, it would be nice if there was a way to do this if the assertions fail. For example, the following would include the request / response in the exception.
The following would also include the request / response in the assertion (possibly with a new assertion exception that contains the original exception as a caused by)
Referenced from: commits 2435820
The text was updated successfully, but these errors were encountered: