StatusAssertion value methods fail when used with custom status code
This commit is contained in:
parent
b2bcb0f93a
commit
79b5710386
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,6 +147,10 @@ class StatusAssertionTests {
|
|||
assertions.value(equalTo(200)));
|
||||
}
|
||||
|
||||
@Test
|
||||
void matchesWithCustomStatus() {
|
||||
statusAssertions(600).value(equalTo(600));
|
||||
}
|
||||
|
||||
private StatusAssertions statusAssertions(HttpStatus status) {
|
||||
return statusAssertions(status.value());
|
||||
|
|
|
|||
Loading…
Reference in New Issue