Class StatusResultMatchers
java.lang.Object
org.springframework.test.web.servlet.result.StatusResultMatchers
Factory for assertions on the response status.
An instance of this class is typically accessed via
MockMvcResultMatchers.status()
.
- Since:
- 3.2
- Author:
- Keesun Baik, Rossen Stoyanchev, Sebastien Deleuze, Brian Clozel
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionis
(int status) Assert the response status code is equal to an integer value.Assert the response status code with the given HamcrestMatcher
.Assert the response status code is in the 1xx range.Assert the response status code is in the 2xx range.Assert the response status code is in the 3xx range.Assert the response status code is in the 4xx range.Assert the response status code is in the 5xx range.Assert the response status code isHttpStatus.ACCEPTED
(202).Assert the response status code isHttpStatus.ALREADY_REPORTED
(208).Assert the response status code isHttpStatus.BAD_GATEWAY
(502).Assert the response status code isHttpStatus.BAD_REQUEST
(400).Assert the response status code isHttpStatus.BANDWIDTH_LIMIT_EXCEEDED
(509).Deprecated.Assert the response status code isHttpStatus.CONFLICT
(409).Assert the response status code isHttpStatus.CONTINUE
(100).Assert the response status code isHttpStatus.CREATED
(201).Deprecated.matching the deprecation ofHttpStatus.DESTINATION_LOCKED
Assert the response status code isHttpStatus.EARLY_HINTS
(103).Assert the response status code isHttpStatus.EXPECTATION_FAILED
(417).Assert the response status code isHttpStatus.FAILED_DEPENDENCY
(424).Assert the response status code isHttpStatus.FORBIDDEN
(403).isFound()
Assert the response status code isHttpStatus.FOUND
(302).Assert the response status code isHttpStatus.GATEWAY_TIMEOUT
(504).isGone()
Assert the response status code isHttpStatus.GONE
(410).Assert the response status code isHttpStatus.HTTP_VERSION_NOT_SUPPORTED
(505).Assert the response status code isHttpStatus.I_AM_A_TEAPOT
(418).isImUsed()
Assert the response status code isHttpStatus.IM_USED
(226).Deprecated.matching the deprecation ofHttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE
Assert the response status code isHttpStatus.INSUFFICIENT_STORAGE
(507).Assert the response status code isHttpStatus.INTERNAL_SERVER_ERROR
(500).Assert the response status code isHttpStatus.LENGTH_REQUIRED
(411).isLocked()
Assert the response status code isHttpStatus.LOCKED
(423).Assert the response status code isHttpStatus.LOOP_DETECTED
(508).Deprecated.matching the deprecation ofHttpStatus.METHOD_FAILURE
Assert the response status code isHttpStatus.METHOD_NOT_ALLOWED
(405).Assert the response status code isHttpStatus.MOVED_PERMANENTLY
(301).Deprecated.in favor ofisFound()
Assert the response status code isHttpStatus.MULTIPLE_CHOICES
(300).Assert the response status code isHttpStatus.MULTI_STATUS
(207).Assert the response status code isHttpStatus.NETWORK_AUTHENTICATION_REQUIRED
(511).Assert the response status code isHttpStatus.NO_CONTENT
(204).Assert the response status code isHttpStatus.NON_AUTHORITATIVE_INFORMATION
(203).Assert the response status code isHttpStatus.NOT_ACCEPTABLE
(406).Assert the response status code isHttpStatus.NOT_EXTENDED
(510).Assert the response status code isHttpStatus.NOT_FOUND
(404).Assert the response status code isHttpStatus.NOT_IMPLEMENTED
(501).Assert the response status code isHttpStatus.NOT_MODIFIED
(304).isOk()
Assert the response status code isHttpStatus.OK
(200).Assert the response status code isHttpStatus.PARTIAL_CONTENT
(206).Assert the response status code isHttpStatus.PAYLOAD_TOO_LARGE
(413).Assert the response status code isHttpStatus.PAYMENT_REQUIRED
(402).Assert the response status code isHttpStatus.PERMANENT_REDIRECT
(308).Assert the response status code isHttpStatus.PRECONDITION_FAILED
(412).Assert the response status code isHttpStatus.PRECONDITION_REQUIRED
(428).Assert the response status code isHttpStatus.PROCESSING
(102).Assert the response status code isHttpStatus.PROXY_AUTHENTICATION_REQUIRED
(407).Assert the response status code isHttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE
(416).Deprecated.matching the deprecation ofHttpStatus.REQUEST_ENTITY_TOO_LARGE
Assert the response status code isHttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE
(431).Assert the response status code isHttpStatus.REQUEST_TIMEOUT
(408).Deprecated.matching the deprecation ofHttpStatus.REQUEST_URI_TOO_LONG
Assert the response status code isHttpStatus.RESET_CONTENT
(205).Assert the response status code isHttpStatus.SEE_OTHER
(303).Assert the response status code isHttpStatus.SERVICE_UNAVAILABLE
(503).Assert the response status code isHttpStatus.SWITCHING_PROTOCOLS
(101).Assert the response status code isHttpStatus.TEMPORARY_REDIRECT
(307).Assert the response status code isHttpStatus.TOO_EARLY
(425).Assert the response status code isHttpStatus.TOO_MANY_REQUESTS
(429).Assert the response status code isHttpStatus.UNAUTHORIZED
(401).Assert the response status code isHttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS
(451).Assert the response status code isHttpStatus.UNPROCESSABLE_ENTITY
(422).Assert the response status code isHttpStatus.UNSUPPORTED_MEDIA_TYPE
(415).Assert the response status code isHttpStatus.UPGRADE_REQUIRED
(426).Assert the response status code isHttpStatus.REQUEST_URI_TOO_LONG
(414).Deprecated.matching the deprecation ofHttpStatus.USE_PROXY
Assert the response status code isHttpStatus.VARIANT_ALSO_NEGOTIATES
(506).Assert the Servlet response error message.Assert the Servlet response error message with the given HamcrestMatcher
.
-
Constructor Details
-
StatusResultMatchers
protected StatusResultMatchers()Protected constructor. UseMockMvcResultMatchers.status()
.
-
-
Method Details
-
is
Assert the response status code with the given HamcrestMatcher
. Use theStatusResultMatchers.isEqualTo
extension in Kotlin. -
is
Assert the response status code is equal to an integer value. Use theStatusResultMatchers.isEqualTo
extension in Kotlin. -
is1xxInformational
Assert the response status code is in the 1xx range. -
is2xxSuccessful
Assert the response status code is in the 2xx range. -
is3xxRedirection
Assert the response status code is in the 3xx range. -
is4xxClientError
Assert the response status code is in the 4xx range. -
is5xxServerError
Assert the response status code is in the 5xx range. -
reason
Assert the Servlet response error message with the given HamcrestMatcher
. -
reason
Assert the Servlet response error message. -
isContinue
Assert the response status code isHttpStatus.CONTINUE
(100). -
isSwitchingProtocols
Assert the response status code isHttpStatus.SWITCHING_PROTOCOLS
(101). -
isProcessing
Assert the response status code isHttpStatus.PROCESSING
(102). -
isCheckpoint
Deprecated.in favor ofisEarlyHints()
Assert the response status code isHttpStatus.CHECKPOINT
(103).- See Also:
-
isEarlyHints
Assert the response status code isHttpStatus.EARLY_HINTS
(103).- Since:
- 6.0.5
-
isOk
Assert the response status code isHttpStatus.OK
(200). -
isCreated
Assert the response status code isHttpStatus.CREATED
(201). -
isAccepted
Assert the response status code isHttpStatus.ACCEPTED
(202). -
isNonAuthoritativeInformation
Assert the response status code isHttpStatus.NON_AUTHORITATIVE_INFORMATION
(203). -
isNoContent
Assert the response status code isHttpStatus.NO_CONTENT
(204). -
isResetContent
Assert the response status code isHttpStatus.RESET_CONTENT
(205). -
isPartialContent
Assert the response status code isHttpStatus.PARTIAL_CONTENT
(206). -
isMultiStatus
Assert the response status code isHttpStatus.MULTI_STATUS
(207). -
isAlreadyReported
Assert the response status code isHttpStatus.ALREADY_REPORTED
(208). -
isImUsed
Assert the response status code isHttpStatus.IM_USED
(226). -
isMultipleChoices
Assert the response status code isHttpStatus.MULTIPLE_CHOICES
(300). -
isMovedPermanently
Assert the response status code isHttpStatus.MOVED_PERMANENTLY
(301). -
isFound
Assert the response status code isHttpStatus.FOUND
(302). -
isMovedTemporarily
Deprecated.in favor ofisFound()
Assert the response status code isHttpStatus.MOVED_TEMPORARILY
(302).- See Also:
-
isSeeOther
Assert the response status code isHttpStatus.SEE_OTHER
(303). -
isNotModified
Assert the response status code isHttpStatus.NOT_MODIFIED
(304). -
isUseProxy
Deprecated.matching the deprecation ofHttpStatus.USE_PROXY
Assert the response status code isHttpStatus.USE_PROXY
(305). -
isTemporaryRedirect
Assert the response status code isHttpStatus.TEMPORARY_REDIRECT
(307). -
isPermanentRedirect
Assert the response status code isHttpStatus.PERMANENT_REDIRECT
(308). -
isBadRequest
Assert the response status code isHttpStatus.BAD_REQUEST
(400). -
isUnauthorized
Assert the response status code isHttpStatus.UNAUTHORIZED
(401). -
isPaymentRequired
Assert the response status code isHttpStatus.PAYMENT_REQUIRED
(402). -
isForbidden
Assert the response status code isHttpStatus.FORBIDDEN
(403). -
isNotFound
Assert the response status code isHttpStatus.NOT_FOUND
(404). -
isMethodNotAllowed
Assert the response status code isHttpStatus.METHOD_NOT_ALLOWED
(405). -
isNotAcceptable
Assert the response status code isHttpStatus.NOT_ACCEPTABLE
(406). -
isProxyAuthenticationRequired
Assert the response status code isHttpStatus.PROXY_AUTHENTICATION_REQUIRED
(407). -
isRequestTimeout
Assert the response status code isHttpStatus.REQUEST_TIMEOUT
(408). -
isConflict
Assert the response status code isHttpStatus.CONFLICT
(409). -
isGone
Assert the response status code isHttpStatus.GONE
(410). -
isLengthRequired
Assert the response status code isHttpStatus.LENGTH_REQUIRED
(411). -
isPreconditionFailed
Assert the response status code isHttpStatus.PRECONDITION_FAILED
(412). -
isPayloadTooLarge
Assert the response status code isHttpStatus.PAYLOAD_TOO_LARGE
(413).- Since:
- 4.1
-
isRequestEntityTooLarge
Deprecated.matching the deprecation ofHttpStatus.REQUEST_ENTITY_TOO_LARGE
Assert the response status code isHttpStatus.REQUEST_ENTITY_TOO_LARGE
(413).- See Also:
-
isUriTooLong
Assert the response status code isHttpStatus.REQUEST_URI_TOO_LONG
(414).- Since:
- 4.1
-
isRequestUriTooLong
Deprecated.matching the deprecation ofHttpStatus.REQUEST_URI_TOO_LONG
Assert the response status code isHttpStatus.REQUEST_URI_TOO_LONG
(414).- See Also:
-
isUnsupportedMediaType
Assert the response status code isHttpStatus.UNSUPPORTED_MEDIA_TYPE
(415). -
isRequestedRangeNotSatisfiable
Assert the response status code isHttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE
(416). -
isExpectationFailed
Assert the response status code isHttpStatus.EXPECTATION_FAILED
(417). -
isIAmATeapot
Assert the response status code isHttpStatus.I_AM_A_TEAPOT
(418). -
isInsufficientSpaceOnResource
Deprecated.matching the deprecation ofHttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE
Assert the response status code isHttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE
(419). -
isMethodFailure
Deprecated.matching the deprecation ofHttpStatus.METHOD_FAILURE
Assert the response status code isHttpStatus.METHOD_FAILURE
(420). -
isDestinationLocked
Deprecated.matching the deprecation ofHttpStatus.DESTINATION_LOCKED
Assert the response status code isHttpStatus.DESTINATION_LOCKED
(421). -
isUnprocessableEntity
Assert the response status code isHttpStatus.UNPROCESSABLE_ENTITY
(422). -
isLocked
Assert the response status code isHttpStatus.LOCKED
(423). -
isFailedDependency
Assert the response status code isHttpStatus.FAILED_DEPENDENCY
(424). -
isTooEarly
Assert the response status code isHttpStatus.TOO_EARLY
(425).- Since:
- 5.2
-
isUpgradeRequired
Assert the response status code isHttpStatus.UPGRADE_REQUIRED
(426). -
isPreconditionRequired
Assert the response status code isHttpStatus.PRECONDITION_REQUIRED
(428). -
isTooManyRequests
Assert the response status code isHttpStatus.TOO_MANY_REQUESTS
(429). -
isRequestHeaderFieldsTooLarge
Assert the response status code isHttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE
(431). -
isInternalServerError
Assert the response status code isHttpStatus.INTERNAL_SERVER_ERROR
(500). -
isNotImplemented
Assert the response status code isHttpStatus.NOT_IMPLEMENTED
(501). -
isBadGateway
Assert the response status code isHttpStatus.BAD_GATEWAY
(502). -
isGatewayTimeout
Assert the response status code isHttpStatus.GATEWAY_TIMEOUT
(504). -
isHttpVersionNotSupported
Assert the response status code isHttpStatus.HTTP_VERSION_NOT_SUPPORTED
(505). -
isVariantAlsoNegotiates
Assert the response status code isHttpStatus.VARIANT_ALSO_NEGOTIATES
(506). -
isInsufficientStorage
Assert the response status code isHttpStatus.INSUFFICIENT_STORAGE
(507). -
isLoopDetected
Assert the response status code isHttpStatus.LOOP_DETECTED
(508). -
isBandwidthLimitExceeded
Assert the response status code isHttpStatus.BANDWIDTH_LIMIT_EXCEEDED
(509). -
isNotExtended
Assert the response status code isHttpStatus.NOT_EXTENDED
(510). -
isNetworkAuthenticationRequired
Assert the response status code isHttpStatus.NETWORK_AUTHENTICATION_REQUIRED
(511).
-
isEarlyHints()