spring-framework / org.springframework.test.web.servlet.result / StatusResultMatchers

StatusResultMatchers

open class StatusResultMatchers

Factory for assertions on the response status.

An instance of this class is typically accessed via MockMvcResultMatchers#status.

Author
Keesun Baik

Author
Rossen Stoyanchev

Author
Sebastien Deleuze

Author
Brian Clozel

Since
3.2

Functions

is

open fun is(matcher: Matcher<Int>): ResultMatcher

Assert the response status code with the given Hamcrest Matcher.

open fun is(status: Int): ResultMatcher

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

is1xxInformational

open fun is1xxInformational(): ResultMatcher

Assert the response status code is in the 1xx range.

is2xxSuccessful

open fun is2xxSuccessful(): ResultMatcher

Assert the response status code is in the 2xx range.

is3xxRedirection

open fun is3xxRedirection(): ResultMatcher

Assert the response status code is in the 3xx range.

is4xxClientError

open fun is4xxClientError(): ResultMatcher

Assert the response status code is in the 4xx range.

is5xxServerError

open fun is5xxServerError(): ResultMatcher

Assert the response status code is in the 5xx range.

isAccepted

open fun isAccepted(): ResultMatcher

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

isAlreadyReported

open fun isAlreadyReported(): ResultMatcher

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

isBadGateway

open fun isBadGateway(): ResultMatcher

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

isBadRequest

open fun isBadRequest(): ResultMatcher

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

isBandwidthLimitExceeded

open fun isBandwidthLimitExceeded(): ResultMatcher

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

isCheckpoint

open fun isCheckpoint(): ResultMatcher

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

isConflict

open fun isConflict(): ResultMatcher

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

isContinue

open fun isContinue(): ResultMatcher

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

isCreated

open fun isCreated(): ResultMatcher

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

isDestinationLocked

open fun isDestinationLocked(): ResultMatcher

Assert the response status code is HttpStatus.DESTINATION_LOCKED (421).

isExpectationFailed

open fun isExpectationFailed(): ResultMatcher

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

isFailedDependency

open fun isFailedDependency(): ResultMatcher

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

isForbidden

open fun isForbidden(): ResultMatcher

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

isFound

open fun isFound(): ResultMatcher

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

isGatewayTimeout

open fun isGatewayTimeout(): ResultMatcher

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

isGone

open fun isGone(): ResultMatcher

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

isHttpVersionNotSupported

open fun isHttpVersionNotSupported(): ResultMatcher

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

isIAmATeapot

open fun isIAmATeapot(): ResultMatcher

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

isImUsed

open fun isImUsed(): ResultMatcher

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

isInsufficientSpaceOnResource

open fun isInsufficientSpaceOnResource(): ResultMatcher

Assert the response status code is HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE (419).

isInsufficientStorage

open fun isInsufficientStorage(): ResultMatcher

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

isInternalServerError

open fun isInternalServerError(): ResultMatcher

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

isLengthRequired

open fun isLengthRequired(): ResultMatcher

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

isLocked

open fun isLocked(): ResultMatcher

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

isLoopDetected

open fun isLoopDetected(): ResultMatcher

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

isMethodFailure

open fun isMethodFailure(): ResultMatcher

Assert the response status code is HttpStatus.METHOD_FAILURE (420).

isMethodNotAllowed

open fun isMethodNotAllowed(): ResultMatcher

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

isMovedPermanently

open fun isMovedPermanently(): ResultMatcher

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

isMovedTemporarily

open fun isMovedTemporarily(): ResultMatcher

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

isMultiStatus

open fun isMultiStatus(): ResultMatcher

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

isMultipleChoices

open fun isMultipleChoices(): ResultMatcher

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

isNetworkAuthenticationRequired

open fun isNetworkAuthenticationRequired(): ResultMatcher

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

isNoContent

open fun isNoContent(): ResultMatcher

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

isNonAuthoritativeInformation

open fun isNonAuthoritativeInformation(): ResultMatcher

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

isNotAcceptable

open fun isNotAcceptable(): ResultMatcher

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

isNotExtended

open fun isNotExtended(): ResultMatcher

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

isNotFound

open fun isNotFound(): ResultMatcher

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

isNotImplemented

open fun isNotImplemented(): ResultMatcher

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

isNotModified

open fun isNotModified(): ResultMatcher

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

isOk

open fun isOk(): ResultMatcher

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

isPartialContent

open fun isPartialContent(): ResultMatcher

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

isPayloadTooLarge

open fun isPayloadTooLarge(): ResultMatcher

Assert the response status code is HttpStatus.PAYLOAD_TOO_LARGE (413).

isPaymentRequired

open fun isPaymentRequired(): ResultMatcher

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

isPermanentRedirect

open fun isPermanentRedirect(): ResultMatcher

Assert the response status code is HttpStatus.PERMANENT_REDIRECT (308).

isPreconditionFailed

open fun isPreconditionFailed(): ResultMatcher

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

isPreconditionRequired

open fun isPreconditionRequired(): ResultMatcher

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

isProcessing

open fun isProcessing(): ResultMatcher

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

isProxyAuthenticationRequired

open fun isProxyAuthenticationRequired(): ResultMatcher

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

isRequestEntityTooLarge

open fun isRequestEntityTooLarge(): ResultMatcher

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

isRequestHeaderFieldsTooLarge

open fun isRequestHeaderFieldsTooLarge(): ResultMatcher

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

isRequestTimeout

open fun isRequestTimeout(): ResultMatcher

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

isRequestUriTooLong

open fun isRequestUriTooLong(): ResultMatcher

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

isRequestedRangeNotSatisfiable

open fun isRequestedRangeNotSatisfiable(): ResultMatcher

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

isResetContent

open fun isResetContent(): ResultMatcher

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

isSeeOther

open fun isSeeOther(): ResultMatcher

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

isServiceUnavailable

open fun isServiceUnavailable(): ResultMatcher

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

isSwitchingProtocols

open fun isSwitchingProtocols(): ResultMatcher

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

isTemporaryRedirect

open fun isTemporaryRedirect(): ResultMatcher

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

isTooManyRequests

open fun isTooManyRequests(): ResultMatcher

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

isUnauthorized

open fun isUnauthorized(): ResultMatcher

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

isUnavailableForLegalReasons

open fun isUnavailableForLegalReasons(): ResultMatcher

Assert the response status code is HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS (451).

isUnprocessableEntity

open fun isUnprocessableEntity(): ResultMatcher

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

isUnsupportedMediaType

open fun isUnsupportedMediaType(): ResultMatcher

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

isUpgradeRequired

open fun isUpgradeRequired(): ResultMatcher

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

isUriTooLong

open fun isUriTooLong(): ResultMatcher

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

isUseProxy

open fun isUseProxy(): ResultMatcher

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

isVariantAlsoNegotiates

open fun isVariantAlsoNegotiates(): ResultMatcher

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

reason

open fun reason(matcher: Matcher<in String>): ResultMatcher

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

open fun reason(reason: String): ResultMatcher

Assert the Servlet response error message.