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 SummaryConstructors
- 
Method SummaryModifier 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_LOCKEDAssert 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_RESOURCEAssert 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_FAILUREAssert 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_LARGEAssert 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_LONGAssert 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_PROXYAssert 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- 
StatusResultMatchersprotected StatusResultMatchers()Protected constructor. UseMockMvcResultMatchers.status().
 
- 
- 
Method Details- 
isAssert the response status code with the given HamcrestMatcher. Use theStatusResultMatchers.isEqualToextension in Kotlin.
- 
isAssert the response status code is equal to an integer value. Use theStatusResultMatchers.isEqualToextension in Kotlin.
- 
is1xxInformationalAssert the response status code is in the 1xx range.
- 
is2xxSuccessfulAssert the response status code is in the 2xx range.
- 
is3xxRedirectionAssert the response status code is in the 3xx range.
- 
is4xxClientErrorAssert the response status code is in the 4xx range.
- 
is5xxServerErrorAssert the response status code is in the 5xx range.
- 
reasonAssert the Servlet response error message with the given HamcrestMatcher.
- 
reasonAssert the Servlet response error message.
- 
isContinueAssert the response status code isHttpStatus.CONTINUE(100).
- 
isSwitchingProtocolsAssert the response status code isHttpStatus.SWITCHING_PROTOCOLS(101).
- 
isProcessingAssert the response status code isHttpStatus.PROCESSING(102).
- 
isCheckpointDeprecated.in favor ofisEarlyHints()Assert the response status code isHttpStatus.CHECKPOINT(103).- See Also:
 
- 
isEarlyHintsAssert the response status code isHttpStatus.EARLY_HINTS(103).- Since:
- 6.0.5
 
- 
isOkAssert the response status code isHttpStatus.OK(200).
- 
isCreatedAssert the response status code isHttpStatus.CREATED(201).
- 
isAcceptedAssert the response status code isHttpStatus.ACCEPTED(202).
- 
isNonAuthoritativeInformationAssert the response status code isHttpStatus.NON_AUTHORITATIVE_INFORMATION(203).
- 
isNoContentAssert the response status code isHttpStatus.NO_CONTENT(204).
- 
isResetContentAssert the response status code isHttpStatus.RESET_CONTENT(205).
- 
isPartialContentAssert the response status code isHttpStatus.PARTIAL_CONTENT(206).
- 
isMultiStatusAssert the response status code isHttpStatus.MULTI_STATUS(207).
- 
isAlreadyReportedAssert the response status code isHttpStatus.ALREADY_REPORTED(208).
- 
isImUsedAssert the response status code isHttpStatus.IM_USED(226).
- 
isMultipleChoicesAssert the response status code isHttpStatus.MULTIPLE_CHOICES(300).
- 
isMovedPermanentlyAssert the response status code isHttpStatus.MOVED_PERMANENTLY(301).
- 
isFoundAssert the response status code isHttpStatus.FOUND(302).
- 
isMovedTemporarilyDeprecated.in favor ofisFound()Assert the response status code isHttpStatus.MOVED_TEMPORARILY(302).- See Also:
 
- 
isSeeOtherAssert the response status code isHttpStatus.SEE_OTHER(303).
- 
isNotModifiedAssert the response status code isHttpStatus.NOT_MODIFIED(304).
- 
isUseProxyDeprecated.matching the deprecation ofHttpStatus.USE_PROXYAssert the response status code isHttpStatus.USE_PROXY(305).
- 
isTemporaryRedirectAssert the response status code isHttpStatus.TEMPORARY_REDIRECT(307).
- 
isPermanentRedirectAssert the response status code isHttpStatus.PERMANENT_REDIRECT(308).
- 
isBadRequestAssert the response status code isHttpStatus.BAD_REQUEST(400).
- 
isUnauthorizedAssert the response status code isHttpStatus.UNAUTHORIZED(401).
- 
isPaymentRequiredAssert the response status code isHttpStatus.PAYMENT_REQUIRED(402).
- 
isForbiddenAssert the response status code isHttpStatus.FORBIDDEN(403).
- 
isNotFoundAssert the response status code isHttpStatus.NOT_FOUND(404).
- 
isMethodNotAllowedAssert the response status code isHttpStatus.METHOD_NOT_ALLOWED(405).
- 
isNotAcceptableAssert the response status code isHttpStatus.NOT_ACCEPTABLE(406).
- 
isProxyAuthenticationRequiredAssert the response status code isHttpStatus.PROXY_AUTHENTICATION_REQUIRED(407).
- 
isRequestTimeoutAssert the response status code isHttpStatus.REQUEST_TIMEOUT(408).
- 
isConflictAssert the response status code isHttpStatus.CONFLICT(409).
- 
isGoneAssert the response status code isHttpStatus.GONE(410).
- 
isLengthRequiredAssert the response status code isHttpStatus.LENGTH_REQUIRED(411).
- 
isPreconditionFailedAssert the response status code isHttpStatus.PRECONDITION_FAILED(412).
- 
isPayloadTooLargeAssert the response status code isHttpStatus.PAYLOAD_TOO_LARGE(413).- Since:
- 4.1
 
- 
isRequestEntityTooLargeDeprecated.matching the deprecation ofHttpStatus.REQUEST_ENTITY_TOO_LARGEAssert the response status code isHttpStatus.REQUEST_ENTITY_TOO_LARGE(413).- See Also:
 
- 
isUriTooLongAssert the response status code isHttpStatus.REQUEST_URI_TOO_LONG(414).- Since:
- 4.1
 
- 
isRequestUriTooLongDeprecated.matching the deprecation ofHttpStatus.REQUEST_URI_TOO_LONGAssert the response status code isHttpStatus.REQUEST_URI_TOO_LONG(414).- See Also:
 
- 
isUnsupportedMediaTypeAssert the response status code isHttpStatus.UNSUPPORTED_MEDIA_TYPE(415).
- 
isRequestedRangeNotSatisfiableAssert the response status code isHttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE(416).
- 
isExpectationFailedAssert the response status code isHttpStatus.EXPECTATION_FAILED(417).
- 
isIAmATeapotAssert the response status code isHttpStatus.I_AM_A_TEAPOT(418).
- 
isInsufficientSpaceOnResourceDeprecated.matching the deprecation ofHttpStatus.INSUFFICIENT_SPACE_ON_RESOURCEAssert the response status code isHttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE(419).
- 
isMethodFailureDeprecated.matching the deprecation ofHttpStatus.METHOD_FAILUREAssert the response status code isHttpStatus.METHOD_FAILURE(420).
- 
isDestinationLockedDeprecated.matching the deprecation ofHttpStatus.DESTINATION_LOCKEDAssert the response status code isHttpStatus.DESTINATION_LOCKED(421).
- 
isUnprocessableEntityAssert the response status code isHttpStatus.UNPROCESSABLE_ENTITY(422).
- 
isLockedAssert the response status code isHttpStatus.LOCKED(423).
- 
isFailedDependencyAssert the response status code isHttpStatus.FAILED_DEPENDENCY(424).
- 
isTooEarlyAssert the response status code isHttpStatus.TOO_EARLY(425).- Since:
- 5.2
 
- 
isUpgradeRequiredAssert the response status code isHttpStatus.UPGRADE_REQUIRED(426).
- 
isPreconditionRequiredAssert the response status code isHttpStatus.PRECONDITION_REQUIRED(428).
- 
isTooManyRequestsAssert the response status code isHttpStatus.TOO_MANY_REQUESTS(429).
- 
isRequestHeaderFieldsTooLargeAssert the response status code isHttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE(431).
- 
isInternalServerErrorAssert the response status code isHttpStatus.INTERNAL_SERVER_ERROR(500).
- 
isNotImplementedAssert the response status code isHttpStatus.NOT_IMPLEMENTED(501).
- 
isBadGatewayAssert the response status code isHttpStatus.BAD_GATEWAY(502).
- 
isGatewayTimeoutAssert the response status code isHttpStatus.GATEWAY_TIMEOUT(504).
- 
isHttpVersionNotSupportedAssert the response status code isHttpStatus.HTTP_VERSION_NOT_SUPPORTED(505).
- 
isVariantAlsoNegotiatesAssert the response status code isHttpStatus.VARIANT_ALSO_NEGOTIATES(506).
- 
isInsufficientStorageAssert the response status code isHttpStatus.INSUFFICIENT_STORAGE(507).
- 
isLoopDetectedAssert the response status code isHttpStatus.LOOP_DETECTED(508).
- 
isBandwidthLimitExceededAssert the response status code isHttpStatus.BANDWIDTH_LIMIT_EXCEEDED(509).
- 
isNotExtendedAssert the response status code isHttpStatus.NOT_EXTENDED(510).
- 
isNetworkAuthenticationRequiredAssert the response status code isHttpStatus.NETWORK_AUTHENTICATION_REQUIRED(511).
 
- 
isEarlyHints()