类 StatusAssertions
- java.lang.Object
- org.springframework.test.web.reactive.server.StatusAssertions
public class StatusAssertions extends Object
Assertions on the response status.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
- 另请参阅:
WebTestClient.ResponseSpec.expectStatus()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.
方法详细资料
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).- 从以下版本开始:
- 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.- 参数:
matcher
- the matcher to use- 从以下版本开始:
- 5.1
value
public WebTestClient.ResponseSpec value(Consumer<Integer> consumer)
Consume the response status value as an integer.- 参数:
consumer
- the consumer to use- 从以下版本开始:
- 5.1