Class StatusAssertions
- java.lang.Object
- org.springframework.test.web.reactive.server.StatusAssertions
public class StatusAssertions extends Object
Assertions on the response status.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
- See Also:
WebTestClient.ResponseSpec.expectStatus()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WebTestClient.ResponseSpec
is1xxInformational()
Assert the response status code is in the 1xx range.WebTestClient.ResponseSpec
is2xxSuccessful()
Assert the response status code is in the 2xx range.WebTestClient.ResponseSpec
is3xxRedirection()
Assert the response status code is in the 3xx range.WebTestClient.ResponseSpec
is4xxClientError()
Assert the response status code is in the 4xx range.WebTestClient.ResponseSpec
is5xxServerError()
Assert the response status code is in the 5xx range.WebTestClient.ResponseSpec
isAccepted()
Assert the response status code isHttpStatus.ACCEPTED
(202).WebTestClient.ResponseSpec
isBadRequest()
Assert the response status code isHttpStatus.BAD_REQUEST
(400).WebTestClient.ResponseSpec
isCreated()
Assert the response status code isHttpStatus.CREATED
(201).WebTestClient.ResponseSpec
isEqualTo(int status)
Assert the response status as an integer.WebTestClient.ResponseSpec
isEqualTo(HttpStatus status)
Assert the response status as anHttpStatus
.WebTestClient.ResponseSpec
isForbidden()
Assert the response status code isHttpStatus.FORBIDDEN
(403).WebTestClient.ResponseSpec
isFound()
Assert the response status code isHttpStatus.FOUND
(302).WebTestClient.ResponseSpec
isNoContent()
Assert the response status code isHttpStatus.NO_CONTENT
(204).WebTestClient.ResponseSpec
isNotFound()
Assert the response status code isHttpStatus.NOT_FOUND
(404).WebTestClient.ResponseSpec
isNotModified()
Assert the response status code isHttpStatus.NOT_MODIFIED
(304).WebTestClient.ResponseSpec
isOk()
Assert the response status code isHttpStatus.OK
(200).WebTestClient.ResponseSpec
isPermanentRedirect()
Assert the response status code isHttpStatus.PERMANENT_REDIRECT
(308).WebTestClient.ResponseSpec
isSeeOther()
Assert the response status code isHttpStatus.SEE_OTHER
(303).WebTestClient.ResponseSpec
isTemporaryRedirect()
Assert the response status code isHttpStatus.TEMPORARY_REDIRECT
(307).WebTestClient.ResponseSpec
isUnauthorized()
Assert the response status code isHttpStatus.UNAUTHORIZED
(401).WebTestClient.ResponseSpec
reasonEquals(String reason)
Assert the response error message.WebTestClient.ResponseSpec
value(Consumer<Integer> consumer)
Consume the response status value as an integer.WebTestClient.ResponseSpec
value(Matcher<Integer> matcher)
Match the response status value with a Hamcrest matcher.
Method Detail
isEqualTo
public WebTestClient.ResponseSpec isEqualTo(HttpStatus status)
Assert the response status as anHttpStatus
.
isEqualTo
public WebTestClient.ResponseSpec isEqualTo(int status)
Assert the response status as an integer.
isOk
public WebTestClient.ResponseSpec isOk()
Assert the response status code isHttpStatus.OK
(200).
isCreated
public WebTestClient.ResponseSpec isCreated()
Assert the response status code isHttpStatus.CREATED
(201).
isAccepted
public WebTestClient.ResponseSpec isAccepted()
Assert the response status code isHttpStatus.ACCEPTED
(202).
isNoContent
public WebTestClient.ResponseSpec isNoContent()
Assert the response status code isHttpStatus.NO_CONTENT
(204).
isFound
public WebTestClient.ResponseSpec isFound()
Assert the response status code isHttpStatus.FOUND
(302).
isSeeOther
public WebTestClient.ResponseSpec isSeeOther()
Assert the response status code isHttpStatus.SEE_OTHER
(303).
isNotModified
public WebTestClient.ResponseSpec isNotModified()
Assert the response status code isHttpStatus.NOT_MODIFIED
(304).
isTemporaryRedirect
public WebTestClient.ResponseSpec isTemporaryRedirect()
Assert the response status code isHttpStatus.TEMPORARY_REDIRECT
(307).
isPermanentRedirect
public WebTestClient.ResponseSpec isPermanentRedirect()
Assert the response status code isHttpStatus.PERMANENT_REDIRECT
(308).
isBadRequest
public WebTestClient.ResponseSpec isBadRequest()
Assert the response status code isHttpStatus.BAD_REQUEST
(400).
isUnauthorized
public WebTestClient.ResponseSpec isUnauthorized()
Assert the response status code isHttpStatus.UNAUTHORIZED
(401).
isForbidden
public WebTestClient.ResponseSpec isForbidden()
Assert the response status code isHttpStatus.FORBIDDEN
(403).- Since:
- 5.0.2
isNotFound
public WebTestClient.ResponseSpec isNotFound()
Assert the response status code isHttpStatus.NOT_FOUND
(404).
reasonEquals
public WebTestClient.ResponseSpec reasonEquals(String reason)
Assert the response error message.
is1xxInformational
public WebTestClient.ResponseSpec is1xxInformational()
Assert the response status code is in the 1xx range.
is2xxSuccessful
public WebTestClient.ResponseSpec is2xxSuccessful()
Assert the response status code is in the 2xx range.
is3xxRedirection
public WebTestClient.ResponseSpec is3xxRedirection()
Assert the response status code is in the 3xx range.
is4xxClientError
public WebTestClient.ResponseSpec is4xxClientError()
Assert the response status code is in the 4xx range.
is5xxServerError
public WebTestClient.ResponseSpec is5xxServerError()
Assert the response status code is in the 5xx range.
value
public WebTestClient.ResponseSpec value(Matcher<Integer> matcher)
Match the response status value with a Hamcrest matcher.- Parameters:
matcher
- the matcher to use- Since:
- 5.1
value
public WebTestClient.ResponseSpec value(Consumer<Integer> consumer)
Consume the response status value as an integer.- Parameters:
consumer
- the consumer to use- Since:
- 5.1