StatusAssertion value methods fail when used with custom status code

This commit is contained in:
Michal Stehlik
2021-03-10 13:29:57 +01:00
committed by Juergen Hoeller
parent b2bcb0f93a
commit 79b5710386
2 changed files with 6 additions and 2 deletions

View File

@@ -205,7 +205,7 @@ public class StatusAssertions {
* @since 5.1
*/
public WebTestClient.ResponseSpec value(Matcher<? super Integer> matcher) {
int value = this.exchangeResult.getStatus().value();
int value = this.exchangeResult.getRawStatusCode();
this.exchangeResult.assertWithDiagnostics(() -> MatcherAssert.assertThat("Response status", value, matcher));
return this.responseSpec;
}
@@ -216,7 +216,7 @@ public class StatusAssertions {
* @since 5.1
*/
public WebTestClient.ResponseSpec value(Consumer<Integer> consumer) {
int value = this.exchangeResult.getStatus().value();
int value = this.exchangeResult.getRawStatusCode();
this.exchangeResult.assertWithDiagnostics(() -> consumer.accept(value));
return this.responseSpec;
}