org.springframework.test.web.servlet.result

## Class StatusResultMatchers

- java.lang.Object
- - org.springframework.test.web.servlet.result.StatusResultMatchers

    public class StatusResultMatchers
    extends Object

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

### Constructor Summary

Constructors
`protected` `StatusResultMatchers()` Protected constructor.

### Method Summary

Methods
`ResultMatcher` `is(int status)` Assert the response status code is equal to an integer value.
`ResultMatcher` `is(org.hamcrest.Matcher<Integer> matcher)` Assert the response status code with the given Hamcrest `Matcher`.
`ResultMatcher` `isAccepted()` Assert the response status code is `HttpStatus.ACCEPTED` (202).
`ResultMatcher` `isAlreadyReported()` Assert the response status code is `HttpStatus.ALREADY_REPORTED` (208).
`ResultMatcher` `isBadGateway()` Assert the response status code is `HttpStatus.BAD_GATEWAY` (502).
`ResultMatcher` `isBadRequest()` Assert the response status code is `HttpStatus.BAD_REQUEST` (400).
`ResultMatcher` `isBandwidthLimitExceeded()` Assert the response status code is `HttpStatus.BANDWIDTH_LIMIT_EXCEEDED` (509).
`ResultMatcher` `isCheckpoint()` Assert the response status code is `HttpStatus.CHECKPOINT` (103).
`ResultMatcher` `isConflict()` Assert the response status code is `HttpStatus.CONFLICT` (409).
`ResultMatcher` `isContinue()` Assert the response status code is `HttpStatus.CONTINUE` (100).
`ResultMatcher` `isCreated()` Assert the response status code is `HttpStatus.CREATED` (201).
`ResultMatcher` `isDestinationLocked()` Deprecated. matching the deprecation of HttpStatus.DESTINATION_LOCKED
`ResultMatcher` `isExpectationFailed()` Assert the response status code is `HttpStatus.EXPECTATION_FAILED` (417).
`ResultMatcher` `isFailedDependency()` Assert the response status code is `HttpStatus.FAILED_DEPENDENCY` (424).
`ResultMatcher` `isForbidden()` Assert the response status code is `HttpStatus.FORBIDDEN` (403).
`ResultMatcher` `isFound()` Assert the response status code is `HttpStatus.FOUND` (302).
`ResultMatcher` `isGatewayTimeout()` Assert the response status code is `HttpStatus.GATEWAY_TIMEOUT` (504).
`ResultMatcher` `isGone()` Assert the response status code is `HttpStatus.GONE` (410).
`ResultMatcher` `isHttpVersionNotSupported()` Assert the response status code is `HttpStatus.HTTP_VERSION_NOT_SUPPORTED` (505).
`ResultMatcher` `isIAmATeapot()` Assert the response status code is `HttpStatus.I_AM_A_TEAPOT` (418).
`ResultMatcher` `isImUsed()` Assert the response status code is `HttpStatus.IM_USED` (226).
`ResultMatcher` `isInsufficientSpaceOnResource()` Deprecated. matching the deprecation of HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE
`ResultMatcher` `isInsufficientStorage()` Assert the response status code is `HttpStatus.INSUFFICIENT_STORAGE` (507).
`ResultMatcher` `isInternalServerError()` Assert the response status code is `HttpStatus.INTERNAL_SERVER_ERROR` (500).
`ResultMatcher` `isLengthRequired()` Assert the response status code is `HttpStatus.LENGTH_REQUIRED` (411).
`ResultMatcher` `isLocked()` Assert the response status code is `HttpStatus.LOCKED` (423).
`ResultMatcher` `isLoopDetected()` Assert the response status code is `HttpStatus.LOOP_DETECTED` (508).
`ResultMatcher` `isMethodFailure()` Deprecated. matching the deprecation of HttpStatus.METHOD_FAILURE
`ResultMatcher` `isMethodNotAllowed()` Assert the response status code is `HttpStatus.METHOD_NOT_ALLOWED` (405).
`ResultMatcher` `isMovedPermanently()` Assert the response status code is `HttpStatus.MOVED_PERMANENTLY` (301).
`ResultMatcher` `isMovedTemporarily()` Assert the response status code is `HttpStatus.MOVED_TEMPORARILY` (302).
`ResultMatcher` `isMultipleChoices()` Assert the response status code is `HttpStatus.MULTIPLE_CHOICES` (300).
`ResultMatcher` `isMultiStatus()` Assert the response status code is `HttpStatus.MULTI_STATUS` (207).
`ResultMatcher` `isNetworkAuthenticationRequired()` Assert the response status code is `HttpStatus.NETWORK_AUTHENTICATION_REQUIRED` (511).
`ResultMatcher` `isNoContent()` Assert the response status code is `HttpStatus.NO_CONTENT` (204).
`ResultMatcher` `isNonAuthoritativeInformation()` Assert the response status code is `HttpStatus.NON_AUTHORITATIVE_INFORMATION` (203).
`ResultMatcher` `isNotAcceptable()` Assert the response status code is `HttpStatus.NOT_ACCEPTABLE` (406).
`ResultMatcher` `isNotExtended()` Assert the response status code is `HttpStatus.NOT_EXTENDED` (510).
`ResultMatcher` `isNotFound()` Assert the response status code is `HttpStatus.NOT_FOUND` (404).
`ResultMatcher` `isNotImplemented()` Assert the response status code is `HttpStatus.NOT_IMPLEMENTED` (501).
`ResultMatcher` `isNotModified()` Assert the response status code is `HttpStatus.NOT_MODIFIED` (304).
`ResultMatcher` `isOk()` Assert the response status code is `HttpStatus.OK` (200).
`ResultMatcher` `isPartialContent()` Assert the response status code is `HttpStatus.PARTIAL_CONTENT` (206).
`ResultMatcher` `isPaymentRequired()` Assert the response status code is `HttpStatus.PAYMENT_REQUIRED` (402).
`ResultMatcher` `isPreconditionFailed()` Assert the response status code is `HttpStatus.PRECONDITION_FAILED` (412).
`ResultMatcher` `isPreconditionRequired()` Assert the response status code is `HttpStatus.PRECONDITION_REQUIRED` (428).
`ResultMatcher` `isProcessing()` Assert the response status code is `HttpStatus.PROCESSING` (102).
`ResultMatcher` `isProxyAuthenticationRequired()` Assert the response status code is `HttpStatus.PROXY_AUTHENTICATION_REQUIRED` (407).
`ResultMatcher` `isRequestedRangeNotSatisfiable()` Assert the response status code is `HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE` (416).
`ResultMatcher` `isRequestEntityTooLarge()` Assert the response status code is `HttpStatus.REQUEST_ENTITY_TOO_LARGE` (413).
`ResultMatcher` `isRequestHeaderFieldsTooLarge()` Assert the response status code is `HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE` (431).
`ResultMatcher` `isRequestTimeout()` Assert the response status code is `HttpStatus.REQUEST_TIMEOUT` (408).
`ResultMatcher` `isRequestUriTooLong()` Assert the response status code is `HttpStatus.REQUEST_URI_TOO_LONG` (414).
`ResultMatcher` `isResetContent()` Assert the response status code is `HttpStatus.RESET_CONTENT` (205).
`ResultMatcher` `isResumeIncomplete()` Assert the response status code is `HttpStatus.RESUME_INCOMPLETE` (308).
`ResultMatcher` `isSeeOther()` Assert the response status code is `HttpStatus.SEE_OTHER` (303).
`ResultMatcher` `isServiceUnavailable()` Assert the response status code is `HttpStatus.SERVICE_UNAVAILABLE` (503).
`ResultMatcher` `isSwitchingProtocols()` Assert the response status code is `HttpStatus.SWITCHING_PROTOCOLS` (101).
`ResultMatcher` `isTemporaryRedirect()` Assert the response status code is `HttpStatus.TEMPORARY_REDIRECT` (307).
`ResultMatcher` `isTooManyRequests()` Assert the response status code is `HttpStatus.TOO_MANY_REQUESTS` (429).
`ResultMatcher` `isUnauthorized()` Assert the response status code is `HttpStatus.UNAUTHORIZED` (401).
`ResultMatcher` `isUnprocessableEntity()` Assert the response status code is `HttpStatus.UNPROCESSABLE_ENTITY` (422).
`ResultMatcher` `isUnsupportedMediaType()` Assert the response status code is `HttpStatus.UNSUPPORTED_MEDIA_TYPE` (415).
`ResultMatcher` `isUpgradeRequired()` Assert the response status code is `HttpStatus.UPGRADE_REQUIRED` (426).
`ResultMatcher` `isUseProxy()` Assert the response status code is `HttpStatus.USE_PROXY` (305).
`ResultMatcher` `isVariantAlsoNegotiates()` Assert the response status code is `HttpStatus.VARIANT_ALSO_NEGOTIATES` (506).
`ResultMatcher` `reason(org.hamcrest.Matcher<? super String> matcher)` Assert the Servlet response error message with the given Hamcrest `Matcher`.
`ResultMatcher` `reason(String reason)` Assert the Servlet response error message.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### StatusResultMatchers

    protected StatusResultMatchers()

Protected constructor. Use `MockMvcResultMatchers.status()`.

### Method Detail

#### is

    public ResultMatcher is(org.hamcrest.Matcher<Integer> matcher)

Assert the response status code with the given Hamcrest `Matcher`.

#### is

    public ResultMatcher is(int status)

Assert the response status code is equal to an integer value.

#### reason

    public ResultMatcher reason(org.hamcrest.Matcher<? super String> matcher)

Assert the Servlet response error message with the given Hamcrest `Matcher`.

#### reason

    public ResultMatcher reason(String reason)

Assert the Servlet response error message.

#### isContinue

    public ResultMatcher isContinue()

Assert the response status code is `HttpStatus.CONTINUE` (100).

#### isSwitchingProtocols

    public ResultMatcher isSwitchingProtocols()

Assert the response status code is `HttpStatus.SWITCHING_PROTOCOLS` (101).

#### isProcessing

    public ResultMatcher isProcessing()

Assert the response status code is `HttpStatus.PROCESSING` (102).

#### isCheckpoint

    public ResultMatcher isCheckpoint()

Assert the response status code is `HttpStatus.CHECKPOINT` (103).

#### isOk

    public ResultMatcher isOk()

Assert the response status code is `HttpStatus.OK` (200).

#### isCreated

    public ResultMatcher isCreated()

Assert the response status code is `HttpStatus.CREATED` (201).

#### isAccepted

    public ResultMatcher isAccepted()

Assert the response status code is `HttpStatus.ACCEPTED` (202).

#### isNonAuthoritativeInformation

    public ResultMatcher isNonAuthoritativeInformation()

Assert the response status code is `HttpStatus.NON_AUTHORITATIVE_INFORMATION` (203).

#### isNoContent

    public ResultMatcher isNoContent()

Assert the response status code is `HttpStatus.NO_CONTENT` (204).

#### isResetContent

    public ResultMatcher isResetContent()

Assert the response status code is `HttpStatus.RESET_CONTENT` (205).

#### isPartialContent

    public ResultMatcher isPartialContent()

Assert the response status code is `HttpStatus.PARTIAL_CONTENT` (206).

#### isMultiStatus

    public ResultMatcher isMultiStatus()

Assert the response status code is `HttpStatus.MULTI_STATUS` (207).

#### isAlreadyReported

    public ResultMatcher isAlreadyReported()

Assert the response status code is `HttpStatus.ALREADY_REPORTED` (208).

#### isImUsed

    public ResultMatcher isImUsed()

Assert the response status code is `HttpStatus.IM_USED` (226).

#### isMultipleChoices

    public ResultMatcher isMultipleChoices()

Assert the response status code is `HttpStatus.MULTIPLE_CHOICES` (300).

#### isMovedPermanently

    public ResultMatcher isMovedPermanently()

Assert the response status code is `HttpStatus.MOVED_PERMANENTLY` (301).

#### isFound

    public ResultMatcher isFound()

Assert the response status code is `HttpStatus.FOUND` (302).

#### isMovedTemporarily

    public ResultMatcher isMovedTemporarily()

Assert the response status code is `HttpStatus.MOVED_TEMPORARILY` (302).

#### isSeeOther

    public ResultMatcher isSeeOther()

Assert the response status code is `HttpStatus.SEE_OTHER` (303).

#### isNotModified

    public ResultMatcher isNotModified()

Assert the response status code is `HttpStatus.NOT_MODIFIED` (304).

#### isUseProxy

    public ResultMatcher isUseProxy()

Assert the response status code is `HttpStatus.USE_PROXY` (305).

#### isTemporaryRedirect

    public ResultMatcher isTemporaryRedirect()

Assert the response status code is `HttpStatus.TEMPORARY_REDIRECT` (307).

#### isResumeIncomplete

    public ResultMatcher isResumeIncomplete()

Assert the response status code is `HttpStatus.RESUME_INCOMPLETE` (308).

#### isBadRequest

    public ResultMatcher isBadRequest()

Assert the response status code is `HttpStatus.BAD_REQUEST` (400).

#### isUnauthorized

    public ResultMatcher isUnauthorized()

Assert the response status code is `HttpStatus.UNAUTHORIZED` (401).

#### isPaymentRequired

    public ResultMatcher isPaymentRequired()

Assert the response status code is `HttpStatus.PAYMENT_REQUIRED` (402).

#### isForbidden

    public ResultMatcher isForbidden()

Assert the response status code is `HttpStatus.FORBIDDEN` (403).

#### isNotFound

    public ResultMatcher isNotFound()

Assert the response status code is `HttpStatus.NOT_FOUND` (404).

#### isMethodNotAllowed

    public ResultMatcher isMethodNotAllowed()

Assert the response status code is `HttpStatus.METHOD_NOT_ALLOWED` (405).

#### isNotAcceptable

    public ResultMatcher isNotAcceptable()

Assert the response status code is `HttpStatus.NOT_ACCEPTABLE` (406).

#### isProxyAuthenticationRequired

    public ResultMatcher isProxyAuthenticationRequired()

Assert the response status code is `HttpStatus.PROXY_AUTHENTICATION_REQUIRED` (407).

#### isRequestTimeout

    public ResultMatcher isRequestTimeout()

Assert the response status code is `HttpStatus.REQUEST_TIMEOUT` (408).

#### isConflict

    public ResultMatcher isConflict()

Assert the response status code is `HttpStatus.CONFLICT` (409).

#### isGone

    public ResultMatcher isGone()

Assert the response status code is `HttpStatus.GONE` (410).

#### isLengthRequired

    public ResultMatcher isLengthRequired()

Assert the response status code is `HttpStatus.LENGTH_REQUIRED` (411).

#### isPreconditionFailed

    public ResultMatcher isPreconditionFailed()

Assert the response status code is `HttpStatus.PRECONDITION_FAILED` (412).

#### isRequestEntityTooLarge

    public ResultMatcher isRequestEntityTooLarge()

Assert the response status code is `HttpStatus.REQUEST_ENTITY_TOO_LARGE` (413).

#### isRequestUriTooLong

    public ResultMatcher isRequestUriTooLong()

Assert the response status code is `HttpStatus.REQUEST_URI_TOO_LONG` (414).

#### isUnsupportedMediaType

    public ResultMatcher isUnsupportedMediaType()

Assert the response status code is `HttpStatus.UNSUPPORTED_MEDIA_TYPE` (415).

#### isRequestedRangeNotSatisfiable

    public ResultMatcher isRequestedRangeNotSatisfiable()

Assert the response status code is `HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE` (416).

#### isExpectationFailed

    public ResultMatcher isExpectationFailed()

Assert the response status code is `HttpStatus.EXPECTATION_FAILED` (417).

#### isIAmATeapot

    public ResultMatcher isIAmATeapot()

Assert the response status code is `HttpStatus.I_AM_A_TEAPOT` (418).

#### isInsufficientSpaceOnResource

    @Deprecated
    public ResultMatcher isInsufficientSpaceOnResource()

Deprecated. matching the deprecation of HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE
Assert the response status code is `HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE` (419).

#### isMethodFailure

    @Deprecated
    public ResultMatcher isMethodFailure()

Deprecated. matching the deprecation of HttpStatus.METHOD_FAILURE
Assert the response status code is `HttpStatus.METHOD_FAILURE` (420).

#### isDestinationLocked

    @Deprecated
    public ResultMatcher isDestinationLocked()

Deprecated. matching the deprecation of HttpStatus.DESTINATION_LOCKED
Assert the response status code is `HttpStatus.DESTINATION_LOCKED` (421).

#### isUnprocessableEntity

    public ResultMatcher isUnprocessableEntity()

Assert the response status code is `HttpStatus.UNPROCESSABLE_ENTITY` (422).

#### isLocked

    public ResultMatcher isLocked()

Assert the response status code is `HttpStatus.LOCKED` (423).

#### isFailedDependency

    public ResultMatcher isFailedDependency()

Assert the response status code is `HttpStatus.FAILED_DEPENDENCY` (424).

#### isUpgradeRequired

    public ResultMatcher isUpgradeRequired()

Assert the response status code is `HttpStatus.UPGRADE_REQUIRED` (426).

#### isPreconditionRequired

    public ResultMatcher isPreconditionRequired()

Assert the response status code is `HttpStatus.PRECONDITION_REQUIRED` (428).

#### isTooManyRequests

    public ResultMatcher isTooManyRequests()

Assert the response status code is `HttpStatus.TOO_MANY_REQUESTS` (429).

#### isRequestHeaderFieldsTooLarge

    public ResultMatcher isRequestHeaderFieldsTooLarge()

Assert the response status code is `HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE` (431).

#### isInternalServerError

    public ResultMatcher isInternalServerError()

Assert the response status code is `HttpStatus.INTERNAL_SERVER_ERROR` (500).

#### isNotImplemented

    public ResultMatcher isNotImplemented()

Assert the response status code is `HttpStatus.NOT_IMPLEMENTED` (501).

#### isBadGateway

    public ResultMatcher isBadGateway()

Assert the response status code is `HttpStatus.BAD_GATEWAY` (502).

#### isServiceUnavailable

    public ResultMatcher isServiceUnavailable()

Assert the response status code is `HttpStatus.SERVICE_UNAVAILABLE` (503).

#### isGatewayTimeout

    public ResultMatcher isGatewayTimeout()

Assert the response status code is `HttpStatus.GATEWAY_TIMEOUT` (504).

#### isHttpVersionNotSupported

    public ResultMatcher isHttpVersionNotSupported()

Assert the response status code is `HttpStatus.HTTP_VERSION_NOT_SUPPORTED` (505).

#### isVariantAlsoNegotiates

    public ResultMatcher isVariantAlsoNegotiates()

Assert the response status code is `HttpStatus.VARIANT_ALSO_NEGOTIATES` (506).

#### isInsufficientStorage

    public ResultMatcher isInsufficientStorage()

Assert the response status code is `HttpStatus.INSUFFICIENT_STORAGE` (507).

#### isLoopDetected

    public ResultMatcher isLoopDetected()

Assert the response status code is `HttpStatus.LOOP_DETECTED` (508).

#### isBandwidthLimitExceeded

    public ResultMatcher isBandwidthLimitExceeded()

Assert the response status code is `HttpStatus.BANDWIDTH_LIMIT_EXCEEDED` (509).

#### isNotExtended

    public ResultMatcher isNotExtended()

Assert the response status code is `HttpStatus.NOT_EXTENDED` (510).

#### isNetworkAuthenticationRequired

    public ResultMatcher isNetworkAuthenticationRequired()

Assert the response status code is `HttpStatus.NETWORK_AUTHENTICATION_REQUIRED` (511).