Package | Description |
---|---|
org.springframework.test.web.servlet |
Contains server-side support for testing Spring MVC applications.
|
org.springframework.test.web.servlet.result |
Contains built-in
ResultMatcher and ResultHandler implementations. |
org.springframework.test.web.servlet.setup |
Contains built-in
MockMvcBuilder implementations. |
Modifier and Type | Method and Description |
---|---|
static ResultMatcher |
ResultMatcher.matchAll(ResultMatcher... matchers)
Static method for matching with an array of result matchers.
|
Modifier and Type | Method and Description |
---|---|
ResultActions |
ResultActions.andExpect(ResultMatcher matcher)
Perform an expectation.
|
static ResultMatcher |
ResultMatcher.matchAll(ResultMatcher... matchers)
Static method for matching with an array of result matchers.
|
Modifier and Type | Method and Description |
---|---|
protected MockMvc |
MockMvcBuilderSupport.createMockMvc(Filter[] filters,
MockServletConfig servletConfig,
WebApplicationContext webAppContext,
RequestBuilder defaultRequestBuilder,
java.util.List<ResultMatcher> globalResultMatchers,
java.util.List<ResultHandler> globalResultHandlers,
java.util.List<DispatcherServletCustomizer> dispatcherServletCustomizers) |
Modifier and Type | Method and Description |
---|---|
ResultMatcher |
RequestResultMatchers.asyncNotStarted()
Assert that asynchronous processing was not started.
|
<T> ResultMatcher |
RequestResultMatchers.asyncResult(org.hamcrest.Matcher<T> matcher)
Assert the result from asynchronous processing with the given matcher.
|
<T> ResultMatcher |
RequestResultMatchers.asyncResult(java.lang.Object expectedResult)
Assert the result from asynchronous processing.
|
ResultMatcher |
RequestResultMatchers.asyncStarted()
Assert whether asynchronous processing started, usually as a result of a
controller method returning
Callable or DeferredResult . |
<T> ResultMatcher |
RequestResultMatchers.attribute(java.lang.String name,
org.hamcrest.Matcher<T> matcher)
Assert a request attribute value with the given Hamcrest
Matcher . |
<T> ResultMatcher |
ModelResultMatchers.attribute(java.lang.String name,
org.hamcrest.Matcher<T> matcher)
Assert a model attribute value with the given Hamcrest
Matcher . |
<T> ResultMatcher |
FlashAttributeResultMatchers.attribute(java.lang.String name,
org.hamcrest.Matcher<T> matcher)
Assert a flash attribute's value with the given Hamcrest
Matcher . |
ResultMatcher |
ModelResultMatchers.attribute(java.lang.String name,
java.lang.Object value)
Assert a model attribute value.
|
<T> ResultMatcher |
RequestResultMatchers.attribute(java.lang.String name,
java.lang.Object expectedValue)
Assert a request attribute value.
|
<T> ResultMatcher |
FlashAttributeResultMatchers.attribute(java.lang.String name,
java.lang.Object value)
Assert a flash attribute's value.
|
<T> ResultMatcher |
FlashAttributeResultMatchers.attributeCount(int count)
Assert the number of flash attributes.
|
ResultMatcher |
ModelResultMatchers.attributeDoesNotExist(java.lang.String... names)
Assert the given model attributes do not exist.
|
ResultMatcher |
ModelResultMatchers.attributeErrorCount(java.lang.String name,
int expectedCount)
Assert the given model attribute(s) have errors.
|
ResultMatcher |
ModelResultMatchers.attributeExists(java.lang.String... names)
Assert the given model attributes exist.
|
<T> ResultMatcher |
FlashAttributeResultMatchers.attributeExists(java.lang.String... names)
Assert the existence of the given flash attributes.
|
ResultMatcher |
ModelResultMatchers.attributeHasErrors(java.lang.String... names)
Assert the given model attribute(s) have errors.
|
<T> ResultMatcher |
ModelResultMatchers.attributeHasFieldErrorCode(java.lang.String name,
java.lang.String fieldName,
org.hamcrest.Matcher<? super java.lang.String> matcher)
Assert a field error code for a model attribute using a
Matcher . |
ResultMatcher |
ModelResultMatchers.attributeHasFieldErrorCode(java.lang.String name,
java.lang.String fieldName,
java.lang.String error)
Assert a field error code for a model attribute using exact String match.
|
ResultMatcher |
ModelResultMatchers.attributeHasFieldErrors(java.lang.String name,
java.lang.String... fieldNames)
Assert the given model attribute field(s) have errors.
|
ResultMatcher |
ModelResultMatchers.attributeHasNoErrors(java.lang.String... names)
Assert the given model attribute(s) do not have errors.
|
ResultMatcher |
XpathResultMatchers.booleanValue(java.lang.Boolean value)
Evaluate the XPath and assert the
Boolean value found. |
ResultMatcher |
ContentResultMatchers.bytes(byte[] expectedContent)
Assert the response body content as a byte array.
|
ResultMatcher |
CookieResultMatchers.comment(java.lang.String name,
org.hamcrest.Matcher<? super java.lang.String> matcher)
Assert a cookie's comment with a Hamcrest
Matcher . |
ResultMatcher |
CookieResultMatchers.comment(java.lang.String name,
java.lang.String comment)
Assert a cookie's comment value.
|
ResultMatcher |
ContentResultMatchers.contentType(MediaType contentType)
Assert the ServletResponse content type after parsing it as a MediaType.
|
ResultMatcher |
ContentResultMatchers.contentType(java.lang.String contentType)
Assert the ServletResponse content type.
|
ResultMatcher |
ContentResultMatchers.contentTypeCompatibleWith(MediaType contentType)
Assert the ServletResponse content type is compatible with the given
content type as defined by
MediaType.isCompatibleWith(MediaType) . |
ResultMatcher |
ContentResultMatchers.contentTypeCompatibleWith(java.lang.String contentType)
Assert the ServletResponse content type is compatible with the given
content type as defined by
MediaType.isCompatibleWith(MediaType) . |
ResultMatcher |
HeaderResultMatchers.dateValue(java.lang.String name,
long value)
Assert the primary value of the named response header parsed into a date
using the preferred date format described in RFC 7231.
|
ResultMatcher |
JsonPathResultMatchers.doesNotExist()
Evaluate the JSON path expression against the response content and
assert that a non-null value does not exist at the given path.
|
ResultMatcher |
XpathResultMatchers.doesNotExist()
Evaluate the XPath and assert that content doesn't exist.
|
ResultMatcher |
CookieResultMatchers.doesNotExist(java.lang.String name)
Assert a cookie does not exist.
|
ResultMatcher |
HeaderResultMatchers.doesNotExist(java.lang.String name)
Assert that the named response header does not exist.
|
ResultMatcher |
JsonPathResultMatchers.doesNotHaveJsonPath()
Evaluate the JSON path expression against the supplied
content
and assert that a value, including null values, does not exist
at the given path. |
ResultMatcher |
CookieResultMatchers.domain(java.lang.String name,
org.hamcrest.Matcher<? super java.lang.String> matcher)
Assert a cookie's domain with a Hamcrest
Matcher . |
ResultMatcher |
CookieResultMatchers.domain(java.lang.String name,
java.lang.String domain)
Assert a cookie's domain value.
|
ResultMatcher |
ContentResultMatchers.encoding(java.lang.String characterEncoding)
Assert the character encoding in the ServletResponse.
|
<T> ResultMatcher |
ModelResultMatchers.errorCount(int expectedCount)
Assert the total number of errors in the model.
|
ResultMatcher |
JsonPathResultMatchers.exists()
Evaluate the JSON path expression against the response content and
assert that a non-null value, possibly an empty array or map, exists at
the given path.
|
ResultMatcher |
XpathResultMatchers.exists()
Evaluate the XPath and assert that content exists.
|
ResultMatcher |
CookieResultMatchers.exists(java.lang.String name)
Assert a cookie exists.
|
ResultMatcher |
HeaderResultMatchers.exists(java.lang.String name)
Assert that the named response header exists.
|
static ResultMatcher |
MockMvcResultMatchers.forwardedUrl(java.lang.String expectedUrl)
Asserts the request was forwarded to the given URL.
|
static ResultMatcher |
MockMvcResultMatchers.forwardedUrlPattern(java.lang.String urlPattern)
Asserts the request was forwarded to the given URL.
|
static ResultMatcher |
MockMvcResultMatchers.forwardedUrlTemplate(java.lang.String urlTemplate,
java.lang.Object... uriVars)
Asserts the request was forwarded to the given URL template.
|
ResultMatcher |
HandlerResultMatchers.handlerType(java.lang.Class<?> type)
Assert the type of the handler that processed the request.
|
<T> ResultMatcher |
ModelResultMatchers.hasErrors()
Assert the model has errors.
|
ResultMatcher |
JsonPathResultMatchers.hasJsonPath()
Evaluate the JSON path expression against the response content
and assert that a value, possibly
null , exists. |
<T> ResultMatcher |
ModelResultMatchers.hasNoErrors()
Assert the model has no errors.
|
ResultMatcher |
CookieResultMatchers.httpOnly(java.lang.String name,
boolean httpOnly)
Assert whether the cookie must be HTTP only.
|
ResultMatcher |
StatusResultMatchers.is(int status)
Assert the response status code is equal to an integer value.
|
ResultMatcher |
StatusResultMatchers.is(org.hamcrest.Matcher<java.lang.Integer> matcher)
Assert the response status code with the given Hamcrest
Matcher . |
ResultMatcher |
StatusResultMatchers.is1xxInformational()
Assert the response status code is in the 1xx range.
|
ResultMatcher |
StatusResultMatchers.is2xxSuccessful()
Assert the response status code is in the 2xx range.
|
ResultMatcher |
StatusResultMatchers.is3xxRedirection()
Assert the response status code is in the 3xx range.
|
ResultMatcher |
StatusResultMatchers.is4xxClientError()
Assert the response status code is in the 4xx range.
|
ResultMatcher |
StatusResultMatchers.is5xxServerError()
Assert the response status code is in the 5xx range.
|
ResultMatcher |
StatusResultMatchers.isAccepted()
Assert the response status code is
HttpStatus.ACCEPTED (202). |
ResultMatcher |
StatusResultMatchers.isAlreadyReported()
Assert the response status code is
HttpStatus.ALREADY_REPORTED (208). |
ResultMatcher |
JsonPathResultMatchers.isArray()
Evaluate the JSON path expression against the response content and
assert that the result is an array.
|
ResultMatcher |
StatusResultMatchers.isBadGateway()
Assert the response status code is
HttpStatus.BAD_GATEWAY (502). |
ResultMatcher |
StatusResultMatchers.isBadRequest()
Assert the response status code is
HttpStatus.BAD_REQUEST (400). |
ResultMatcher |
StatusResultMatchers.isBandwidthLimitExceeded()
Assert the response status code is
HttpStatus.BANDWIDTH_LIMIT_EXCEEDED (509). |
ResultMatcher |
JsonPathResultMatchers.isBoolean()
Evaluate the JSON path expression against the response content and
assert that the result is a
Boolean . |
ResultMatcher |
StatusResultMatchers.isCheckpoint()
Assert the response status code is
HttpStatus.CHECKPOINT (103). |
ResultMatcher |
StatusResultMatchers.isConflict()
Assert the response status code is
HttpStatus.CONFLICT (409). |
ResultMatcher |
StatusResultMatchers.isContinue()
Assert the response status code is
HttpStatus.CONTINUE (100). |
ResultMatcher |
StatusResultMatchers.isCreated()
Assert the response status code is
HttpStatus.CREATED (201). |
ResultMatcher |
StatusResultMatchers.isDestinationLocked()
Deprecated.
matching the deprecation of
HttpStatus.DESTINATION_LOCKED |
ResultMatcher |
JsonPathResultMatchers.isEmpty()
Evaluate the JSON path expression against the response content and
assert that an empty value exists at the given path.
|
ResultMatcher |
StatusResultMatchers.isExpectationFailed()
Assert the response status code is
HttpStatus.EXPECTATION_FAILED (417). |
ResultMatcher |
StatusResultMatchers.isFailedDependency()
Assert the response status code is
HttpStatus.FAILED_DEPENDENCY (424). |
ResultMatcher |
StatusResultMatchers.isForbidden()
Assert the response status code is
HttpStatus.FORBIDDEN (403). |
ResultMatcher |
StatusResultMatchers.isFound()
Assert the response status code is
HttpStatus.FOUND (302). |
ResultMatcher |
StatusResultMatchers.isGatewayTimeout()
Assert the response status code is
HttpStatus.GATEWAY_TIMEOUT (504). |
ResultMatcher |
StatusResultMatchers.isGone()
Assert the response status code is
HttpStatus.GONE (410). |
ResultMatcher |
StatusResultMatchers.isHttpVersionNotSupported()
Assert the response status code is
HttpStatus.HTTP_VERSION_NOT_SUPPORTED (505). |
ResultMatcher |
StatusResultMatchers.isIAmATeapot()
Assert the response status code is
HttpStatus.I_AM_A_TEAPOT (418). |
ResultMatcher |
StatusResultMatchers.isImUsed()
Assert the response status code is
HttpStatus.IM_USED (226). |
ResultMatcher |
StatusResultMatchers.isInsufficientSpaceOnResource()
Deprecated.
matching the deprecation of
HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE |
ResultMatcher |
StatusResultMatchers.isInsufficientStorage()
Assert the response status code is
HttpStatus.INSUFFICIENT_STORAGE (507). |
ResultMatcher |
StatusResultMatchers.isInternalServerError()
Assert the response status code is
HttpStatus.INTERNAL_SERVER_ERROR (500). |
ResultMatcher |
StatusResultMatchers.isLengthRequired()
Assert the response status code is
HttpStatus.LENGTH_REQUIRED (411). |
ResultMatcher |
StatusResultMatchers.isLocked()
Assert the response status code is
HttpStatus.LOCKED (423). |
ResultMatcher |
StatusResultMatchers.isLoopDetected()
Assert the response status code is
HttpStatus.LOOP_DETECTED (508). |
ResultMatcher |
JsonPathResultMatchers.isMap()
Evaluate the JSON path expression against the response content and
assert that the result is a
Map . |
ResultMatcher |
StatusResultMatchers.isMethodFailure()
Deprecated.
matching the deprecation of
HttpStatus.METHOD_FAILURE |
ResultMatcher |
StatusResultMatchers.isMethodNotAllowed()
Assert the response status code is
HttpStatus.METHOD_NOT_ALLOWED (405). |
ResultMatcher |
StatusResultMatchers.isMovedPermanently()
Assert the response status code is
HttpStatus.MOVED_PERMANENTLY (301). |
ResultMatcher |
StatusResultMatchers.isMovedTemporarily()
Deprecated.
in favor of
StatusResultMatchers.isFound() |
ResultMatcher |
StatusResultMatchers.isMultipleChoices()
Assert the response status code is
HttpStatus.MULTIPLE_CHOICES (300). |
ResultMatcher |
StatusResultMatchers.isMultiStatus()
Assert the response status code is
HttpStatus.MULTI_STATUS (207). |
ResultMatcher |
StatusResultMatchers.isNetworkAuthenticationRequired()
Assert the response status code is
HttpStatus.NETWORK_AUTHENTICATION_REQUIRED (511). |
ResultMatcher |
StatusResultMatchers.isNoContent()
Assert the response status code is
HttpStatus.NO_CONTENT (204). |
ResultMatcher |
StatusResultMatchers.isNonAuthoritativeInformation()
Assert the response status code is
HttpStatus.NON_AUTHORITATIVE_INFORMATION (203). |
ResultMatcher |
StatusResultMatchers.isNotAcceptable()
Assert the response status code is
HttpStatus.NOT_ACCEPTABLE (406). |
ResultMatcher |
JsonPathResultMatchers.isNotEmpty()
Evaluate the JSON path expression against the response content and
assert that a non-empty value exists at the given path.
|
ResultMatcher |
StatusResultMatchers.isNotExtended()
Assert the response status code is
HttpStatus.NOT_EXTENDED (510). |
ResultMatcher |
StatusResultMatchers.isNotFound()
Assert the response status code is
HttpStatus.NOT_FOUND (404). |
ResultMatcher |
StatusResultMatchers.isNotImplemented()
Assert the response status code is
HttpStatus.NOT_IMPLEMENTED (501). |
ResultMatcher |
StatusResultMatchers.isNotModified()
Assert the response status code is
HttpStatus.NOT_MODIFIED (304). |
ResultMatcher |
JsonPathResultMatchers.isNumber()
Evaluate the JSON path expression against the response content and
assert that the result is a
Number . |
ResultMatcher |
StatusResultMatchers.isOk()
Assert the response status code is
HttpStatus.OK (200). |
ResultMatcher |
StatusResultMatchers.isPartialContent()
Assert the response status code is
HttpStatus.PARTIAL_CONTENT (206). |
ResultMatcher |
StatusResultMatchers.isPayloadTooLarge()
Assert the response status code is
HttpStatus.PAYLOAD_TOO_LARGE (413). |
ResultMatcher |
StatusResultMatchers.isPaymentRequired()
Assert the response status code is
HttpStatus.PAYMENT_REQUIRED (402). |
ResultMatcher |
StatusResultMatchers.isPermanentRedirect()
Assert the response status code is
HttpStatus.PERMANENT_REDIRECT (308). |
ResultMatcher |
StatusResultMatchers.isPreconditionFailed()
Assert the response status code is
HttpStatus.PRECONDITION_FAILED (412). |
ResultMatcher |
StatusResultMatchers.isPreconditionRequired()
Assert the response status code is
HttpStatus.PRECONDITION_REQUIRED (428). |
ResultMatcher |
StatusResultMatchers.isProcessing()
Assert the response status code is
HttpStatus.PROCESSING (102). |
ResultMatcher |
StatusResultMatchers.isProxyAuthenticationRequired()
Assert the response status code is
HttpStatus.PROXY_AUTHENTICATION_REQUIRED (407). |
ResultMatcher |
StatusResultMatchers.isRequestedRangeNotSatisfiable()
Assert the response status code is
HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE (416). |
ResultMatcher |
StatusResultMatchers.isRequestEntityTooLarge()
Deprecated.
matching the deprecation of
HttpStatus.REQUEST_ENTITY_TOO_LARGE |
ResultMatcher |
StatusResultMatchers.isRequestHeaderFieldsTooLarge()
Assert the response status code is
HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE (431). |
ResultMatcher |
StatusResultMatchers.isRequestTimeout()
Assert the response status code is
HttpStatus.REQUEST_TIMEOUT (408). |
ResultMatcher |
StatusResultMatchers.isRequestUriTooLong()
Deprecated.
matching the deprecation of
HttpStatus.REQUEST_URI_TOO_LONG |
ResultMatcher |
StatusResultMatchers.isResetContent()
Assert the response status code is
HttpStatus.RESET_CONTENT (205). |
ResultMatcher |
StatusResultMatchers.isSeeOther()
Assert the response status code is
HttpStatus.SEE_OTHER (303). |
ResultMatcher |
StatusResultMatchers.isServiceUnavailable()
Assert the response status code is
HttpStatus.SERVICE_UNAVAILABLE (503). |
ResultMatcher |
JsonPathResultMatchers.isString()
Evaluate the JSON path expression against the response content and
assert that the result is a
String . |
ResultMatcher |
StatusResultMatchers.isSwitchingProtocols()
Assert the response status code is
HttpStatus.SWITCHING_PROTOCOLS (101). |
ResultMatcher |
StatusResultMatchers.isTemporaryRedirect()
Assert the response status code is
HttpStatus.TEMPORARY_REDIRECT (307). |
ResultMatcher |
StatusResultMatchers.isTooManyRequests()
Assert the response status code is
HttpStatus.TOO_MANY_REQUESTS (429). |
ResultMatcher |
StatusResultMatchers.isUnauthorized()
Assert the response status code is
HttpStatus.UNAUTHORIZED (401). |
ResultMatcher |
StatusResultMatchers.isUnavailableForLegalReasons()
Assert the response status code is
HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS (451). |
ResultMatcher |
StatusResultMatchers.isUnprocessableEntity()
Assert the response status code is
HttpStatus.UNPROCESSABLE_ENTITY (422). |
ResultMatcher |
StatusResultMatchers.isUnsupportedMediaType()
Assert the response status code is
HttpStatus.UNSUPPORTED_MEDIA_TYPE (415). |
ResultMatcher |
StatusResultMatchers.isUpgradeRequired()
Assert the response status code is
HttpStatus.UPGRADE_REQUIRED (426). |
ResultMatcher |
StatusResultMatchers.isUriTooLong()
Assert the response status code is
HttpStatus.REQUEST_URI_TOO_LONG (414). |
ResultMatcher |
StatusResultMatchers.isUseProxy()
Deprecated.
matching the deprecation of
HttpStatus.USE_PROXY |
ResultMatcher |
StatusResultMatchers.isVariantAlsoNegotiates()
Assert the response status code is
HttpStatus.VARIANT_ALSO_NEGOTIATES (506). |
ResultMatcher |
ContentResultMatchers.json(java.lang.String jsonContent)
Parse the expected and actual strings as JSON and assert the two
are "similar" - i.e.
|
ResultMatcher |
ContentResultMatchers.json(java.lang.String jsonContent,
boolean strict)
Parse the response content and the given string as JSON and assert the two are "similar" -
i.e.
|
static <T> ResultMatcher |
MockMvcResultMatchers.jsonPath(java.lang.String expression,
org.hamcrest.Matcher<T> matcher)
Access to response body assertions using a
JsonPath expression
to inspect a specific subset of the body and a Hamcrest matcher for
asserting the value found at the JSON path.
|
ResultMatcher |
HeaderResultMatchers.longValue(java.lang.String name,
long value)
Assert the primary value of the named response header as a
long . |
ResultMatcher |
CookieResultMatchers.maxAge(java.lang.String name,
int maxAge)
Assert a cookie's maxAge value.
|
ResultMatcher |
CookieResultMatchers.maxAge(java.lang.String name,
org.hamcrest.Matcher<? super java.lang.Integer> matcher)
Assert a cookie's maxAge with a Hamcrest
Matcher . |
ResultMatcher |
HandlerResultMatchers.method(java.lang.reflect.Method method)
Assert the controller method used to process the request.
|
ResultMatcher |
HandlerResultMatchers.methodCall(java.lang.Object obj)
Assert the controller method used to process the request.
|
ResultMatcher |
HandlerResultMatchers.methodName(org.hamcrest.Matcher<? super java.lang.String> matcher)
Assert the name of the controller method used to process the request
using the given Hamcrest
Matcher . |
ResultMatcher |
HandlerResultMatchers.methodName(java.lang.String name)
Assert the name of the controller method used to process the request.
|
ResultMatcher |
ViewResultMatchers.name(org.hamcrest.Matcher<? super java.lang.String> matcher)
Assert the selected view name with the given Hamcrest
Matcher . |
ResultMatcher |
ViewResultMatchers.name(java.lang.String expectedViewName)
Assert the selected view name.
|
ResultMatcher |
XpathResultMatchers.node(org.hamcrest.Matcher<? super org.w3c.dom.Node> matcher)
Evaluate the XPath and assert the
Node content found with the
given Hamcrest Matcher . |
ResultMatcher |
ContentResultMatchers.node(org.hamcrest.Matcher<? super org.w3c.dom.Node> matcher)
Parse the response content as
Node and apply the given Hamcrest
Matcher . |
ResultMatcher |
XpathResultMatchers.nodeCount(int expectedCount)
Evaluate the XPath and assert the number of nodes found.
|
ResultMatcher |
XpathResultMatchers.nodeCount(org.hamcrest.Matcher<java.lang.Integer> matcher)
Evaluate the XPath and assert the number of nodes found with the given
Hamcrest
Matcher . |
ResultMatcher |
XpathResultMatchers.number(java.lang.Double expectedValue)
Evaluate the XPath and assert the
Double value found. |
ResultMatcher |
XpathResultMatchers.number(org.hamcrest.Matcher<? super java.lang.Double> matcher)
Evaluate the XPath and assert the
Double value found with the
given Hamcrest Matcher . |
ResultMatcher |
CookieResultMatchers.path(java.lang.String name,
org.hamcrest.Matcher<? super java.lang.String> matcher)
Assert a cookie path with a Hamcrest
Matcher . |
ResultMatcher |
CookieResultMatchers.path(java.lang.String name,
java.lang.String path) |
ResultMatcher |
StatusResultMatchers.reason(org.hamcrest.Matcher<? super java.lang.String> matcher)
Assert the Servlet response error message with the given Hamcrest
Matcher . |
ResultMatcher |
StatusResultMatchers.reason(java.lang.String reason)
Assert the Servlet response error message.
|
static ResultMatcher |
MockMvcResultMatchers.redirectedUrl(java.lang.String expectedUrl)
Asserts the request was redirected to the given URL.
|
static ResultMatcher |
MockMvcResultMatchers.redirectedUrlPattern(java.lang.String urlPattern)
Asserts the request was redirected to the given URL.
|
static ResultMatcher |
MockMvcResultMatchers.redirectedUrlTemplate(java.lang.String urlTemplate,
java.lang.Object... uriVars)
Asserts the request was redirected to the given URL template.
|
ResultMatcher |
CookieResultMatchers.secure(java.lang.String name,
boolean secure)
Assert whether the cookie must be sent over a secure protocol or not.
|
<T> ResultMatcher |
RequestResultMatchers.sessionAttribute(java.lang.String name,
org.hamcrest.Matcher<T> matcher)
Assert a session attribute value with the given Hamcrest
Matcher . |
<T> ResultMatcher |
RequestResultMatchers.sessionAttribute(java.lang.String name,
java.lang.Object value)
Assert a session attribute value.
|
<T> ResultMatcher |
ModelResultMatchers.size(int size)
Assert the number of model attributes.
|
ResultMatcher |
ContentResultMatchers.source(org.hamcrest.Matcher<? super javax.xml.transform.Source> matcher)
Parse the response content as
DOMSource and apply the given
Hamcrest Matcher . |
ResultMatcher |
XpathResultMatchers.string(org.hamcrest.Matcher<? super java.lang.String> matcher)
Apply the XPath and assert the
String value found with the given
Hamcrest Matcher . |
ResultMatcher |
ContentResultMatchers.string(org.hamcrest.Matcher<? super java.lang.String> matcher)
Assert the response body content with a Hamcrest
Matcher . |
ResultMatcher |
XpathResultMatchers.string(java.lang.String expectedValue)
Apply the XPath and assert the
String value found. |
ResultMatcher |
ContentResultMatchers.string(java.lang.String expectedContent)
Assert the response body content as a String.
|
ResultMatcher |
HeaderResultMatchers.string(java.lang.String name,
org.hamcrest.Matcher<? super java.lang.String> matcher)
Assert the primary value of the response header with the given Hamcrest
String
Matcher . |
ResultMatcher |
HeaderResultMatchers.string(java.lang.String name,
java.lang.String value)
Assert the primary value of the response header as a String value.
|
<T> ResultMatcher |
HeaderResultMatchers.stringValues(java.lang.String name,
org.hamcrest.Matcher<java.lang.Iterable<java.lang.String>> matcher)
Assert the values of the response header with the given Hamcrest
Iterable
Matcher . |
ResultMatcher |
HeaderResultMatchers.stringValues(java.lang.String name,
java.lang.String... values)
Assert the values of the response header as String values.
|
<T> ResultMatcher |
JsonPathResultMatchers.value(org.hamcrest.Matcher<T> matcher)
Evaluate the JSON path expression against the response content and
assert the resulting value with the given Hamcrest
Matcher . |
<T> ResultMatcher |
JsonPathResultMatchers.value(org.hamcrest.Matcher<T> matcher,
java.lang.Class<T> targetType)
An overloaded variant of
JsonPathResultMatchers.value(Matcher) that also accepts a
target type for the resulting value that the matcher can work reliably
against. |
ResultMatcher |
JsonPathResultMatchers.value(java.lang.Object expectedValue)
Evaluate the JSON path expression against the response content and
assert that the result is equal to the supplied value.
|
ResultMatcher |
CookieResultMatchers.value(java.lang.String name,
org.hamcrest.Matcher<? super java.lang.String> matcher)
Assert a cookie value with the given Hamcrest
Matcher . |
ResultMatcher |
CookieResultMatchers.value(java.lang.String name,
java.lang.String expectedValue)
Assert a cookie value.
|
ResultMatcher |
CookieResultMatchers.version(java.lang.String name,
int version)
Assert a cookie's version value.
|
ResultMatcher |
CookieResultMatchers.version(java.lang.String name,
org.hamcrest.Matcher<? super java.lang.Integer> matcher)
Assert a cookie's version with a Hamcrest
Matcher . |
ResultMatcher |
ContentResultMatchers.xml(java.lang.String xmlContent)
Parse the response content and the given string as XML and assert the two
are "similar" - i.e.
|
Modifier and Type | Method and Description |
---|---|
<T extends B> |
ConfigurableMockMvcBuilder.alwaysExpect(ResultMatcher resultMatcher)
Define a global expectation that should always be applied to
every response.
|
<T extends B> |
AbstractMockMvcBuilder.alwaysExpect(ResultMatcher resultMatcher) |