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,
List<ResultMatcher> globalResultMatchers,
List<ResultHandler> globalResultHandlers,
List<DispatcherServletCustomizer> dispatcherServletCustomizers) |
Modifier and Type | Method and Description |
---|---|
ResultMatcher |
RequestResultMatchers.asyncNotStarted()
Assert that asynchronous processing was not started.
|
<T> ResultMatcher |
RequestResultMatchers.asyncResult(Matcher<T> matcher)
Assert the result from asynchronous processing with the given matcher.
|
<T> ResultMatcher |
RequestResultMatchers.asyncResult(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(String name,
Matcher<T> matcher)
Assert a request attribute value with the given Hamcrest
Matcher . |
<T> ResultMatcher |
ModelResultMatchers.attribute(String name,
Matcher<T> matcher)
Assert a model attribute value with the given Hamcrest
Matcher . |
<T> ResultMatcher |
FlashAttributeResultMatchers.attribute(String name,
Matcher<T> matcher)
Assert a flash attribute's value with the given Hamcrest
Matcher . |
ResultMatcher |
ModelResultMatchers.attribute(String name,
Object value)
Assert a model attribute value.
|
<T> ResultMatcher |
RequestResultMatchers.attribute(String name,
Object expectedValue)
Assert a request attribute value.
|
<T> ResultMatcher |
FlashAttributeResultMatchers.attribute(String name,
Object value)
Assert a flash attribute's value.
|
<T> ResultMatcher |
FlashAttributeResultMatchers.attributeCount(int count)
Assert the number of flash attributes.
|
ResultMatcher |
ModelResultMatchers.attributeDoesNotExist(String... names)
Assert the given model attributes do not exist.
|
ResultMatcher |
ModelResultMatchers.attributeErrorCount(String name,
int expectedCount)
Assert the given model attribute(s) have errors.
|
ResultMatcher |
ModelResultMatchers.attributeExists(String... names)
Assert the given model attributes exist.
|
<T> ResultMatcher |
FlashAttributeResultMatchers.attributeExists(String... names)
Assert the existence of the given flash attributes.
|
ResultMatcher |
ModelResultMatchers.attributeHasErrors(String... names)
Assert the given model attribute(s) have errors.
|
<T> ResultMatcher |
ModelResultMatchers.attributeHasFieldErrorCode(String name,
String fieldName,
Matcher<? super String> matcher)
Assert a field error code for a model attribute using a
Matcher . |
ResultMatcher |
ModelResultMatchers.attributeHasFieldErrorCode(String name,
String fieldName,
String error)
Assert a field error code for a model attribute using exact String match.
|
ResultMatcher |
ModelResultMatchers.attributeHasFieldErrors(String name,
String... fieldNames)
Assert the given model attribute field(s) have errors.
|
ResultMatcher |
ModelResultMatchers.attributeHasNoErrors(String... names)
Assert the given model attribute(s) do not have errors.
|
ResultMatcher |
XpathResultMatchers.booleanValue(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(String name,
Matcher<? super String> matcher)
Assert a cookie's comment with a Hamcrest
Matcher . |
ResultMatcher |
CookieResultMatchers.comment(String name,
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(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(String contentType)
Assert the ServletResponse content type is compatible with the given
content type as defined by
MediaType.isCompatibleWith(MediaType) . |
ResultMatcher |
HeaderResultMatchers.dateValue(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(String name)
Assert a cookie does not exist.
|
ResultMatcher |
HeaderResultMatchers.doesNotExist(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(String name,
Matcher<? super String> matcher)
Assert a cookie's domain with a Hamcrest
Matcher . |
ResultMatcher |
CookieResultMatchers.domain(String name,
String domain)
Assert a cookie's domain value.
|
ResultMatcher |
ContentResultMatchers.encoding(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(String name)
Assert a cookie exists.
|
ResultMatcher |
HeaderResultMatchers.exists(String name)
Assert that the named response header exists.
|
static ResultMatcher |
MockMvcResultMatchers.forwardedUrl(String expectedUrl)
Asserts the request was forwarded to the given URL.
|
static ResultMatcher |
MockMvcResultMatchers.forwardedUrlPattern(String urlPattern)
Asserts the request was forwarded to the given URL.
|
static ResultMatcher |
MockMvcResultMatchers.forwardedUrlTemplate(String urlTemplate,
Object... uriVars)
Asserts the request was forwarded to the given URL template.
|
ResultMatcher |
HandlerResultMatchers.handlerType(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(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(Matcher<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.isTooEarly()
Assert the response status code is
HttpStatus.TOO_EARLY (425). |
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(String jsonContent)
Parse the expected and actual strings as JSON and assert the two
are "similar" - i.e.
|
ResultMatcher |
ContentResultMatchers.json(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(String expression,
Matcher<T> matcher)
|
static <T> ResultMatcher |
MockMvcResultMatchers.jsonPath(String expression,
Matcher<T> matcher,
Class<T> targetType)
|
ResultMatcher |
HeaderResultMatchers.longValue(String name,
long value)
Assert the primary value of the named response header as a
long . |
ResultMatcher |
CookieResultMatchers.maxAge(String name,
int maxAge)
Assert a cookie's maxAge value.
|
ResultMatcher |
CookieResultMatchers.maxAge(String name,
Matcher<? super Integer> matcher)
Assert a cookie's maxAge with a Hamcrest
Matcher . |
ResultMatcher |
HandlerResultMatchers.method(Method method)
Assert the controller method used to process the request.
|
ResultMatcher |
HandlerResultMatchers.methodCall(Object obj)
Assert the controller method used to process the request.
|
ResultMatcher |
HandlerResultMatchers.methodName(Matcher<? super String> matcher)
Assert the name of the controller method used to process the request
using the given Hamcrest
Matcher . |
ResultMatcher |
HandlerResultMatchers.methodName(String name)
Assert the name of the controller method used to process the request.
|
ResultMatcher |
ViewResultMatchers.name(Matcher<? super String> matcher)
Assert the selected view name with the given Hamcrest
Matcher . |
ResultMatcher |
ViewResultMatchers.name(String expectedViewName)
Assert the selected view name.
|
ResultMatcher |
XpathResultMatchers.node(Matcher<? super Node> matcher)
|
ResultMatcher |
ContentResultMatchers.node(Matcher<? super Node> matcher)
|
ResultMatcher |
XpathResultMatchers.nodeCount(int expectedCount)
Evaluate the XPath and assert the number of nodes found.
|
ResultMatcher |
XpathResultMatchers.nodeCount(Matcher<Integer> matcher)
Evaluate the XPath and assert the number of nodes found with the given
Hamcrest
Matcher . |
ResultMatcher |
XpathResultMatchers.number(Double expectedValue)
Evaluate the XPath and assert the
Double value found. |
ResultMatcher |
XpathResultMatchers.number(Matcher<? super Double> matcher)
|
ResultMatcher |
CookieResultMatchers.path(String name,
Matcher<? super String> matcher)
Assert a cookie path with a Hamcrest
Matcher . |
ResultMatcher |
CookieResultMatchers.path(String name,
String path) |
ResultMatcher |
StatusResultMatchers.reason(Matcher<? super String> matcher)
Assert the Servlet response error message with the given Hamcrest
Matcher . |
ResultMatcher |
StatusResultMatchers.reason(String reason)
Assert the Servlet response error message.
|
static ResultMatcher |
MockMvcResultMatchers.redirectedUrl(String expectedUrl)
Asserts the request was redirected to the given URL.
|
static ResultMatcher |
MockMvcResultMatchers.redirectedUrlPattern(String urlPattern)
Asserts the request was redirected to the given URL.
|
static ResultMatcher |
MockMvcResultMatchers.redirectedUrlTemplate(String urlTemplate,
Object... uriVars)
Asserts the request was redirected to the given URL template.
|
ResultMatcher |
CookieResultMatchers.secure(String name,
boolean secure)
Assert whether the cookie must be sent over a secure protocol or not.
|
<T> ResultMatcher |
RequestResultMatchers.sessionAttribute(String name,
Matcher<T> matcher)
Assert a session attribute value with the given Hamcrest
Matcher . |
<T> ResultMatcher |
RequestResultMatchers.sessionAttribute(String name,
Object value)
Assert a session attribute value.
|
<T> ResultMatcher |
ModelResultMatchers.size(int size)
Assert the number of model attributes.
|
ResultMatcher |
ContentResultMatchers.source(Matcher<? super Source> matcher)
|
ResultMatcher |
XpathResultMatchers.string(Matcher<? super String> matcher)
|
ResultMatcher |
ContentResultMatchers.string(Matcher<? super String> matcher)
Assert the response body content with a Hamcrest
Matcher . |
ResultMatcher |
XpathResultMatchers.string(String expectedValue)
Apply the XPath and assert the
String value found. |
ResultMatcher |
ContentResultMatchers.string(String expectedContent)
Assert the response body content as a String.
|
ResultMatcher |
HeaderResultMatchers.string(String name,
Matcher<? super String> matcher)
Assert the primary value of the response header with the given Hamcrest
String
Matcher . |
ResultMatcher |
HeaderResultMatchers.string(String name,
String value)
Assert the primary value of the response header as a String value.
|
<T> ResultMatcher |
HeaderResultMatchers.stringValues(String name,
Matcher<Iterable<String>> matcher)
Assert the values of the response header with the given Hamcrest
Iterable
Matcher . |
ResultMatcher |
HeaderResultMatchers.stringValues(String name,
String... values)
Assert the values of the response header as String values.
|
<T> ResultMatcher |
JsonPathResultMatchers.value(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(Matcher<T> matcher,
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(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(String name,
Matcher<? super String> matcher)
Assert a cookie value with the given Hamcrest
Matcher . |
ResultMatcher |
CookieResultMatchers.value(String name,
String expectedValue)
Assert a cookie value.
|
ResultMatcher |
CookieResultMatchers.version(String name,
int version)
Assert a cookie's version value.
|
ResultMatcher |
CookieResultMatchers.version(String name,
Matcher<? super Integer> matcher)
Assert a cookie's version with a Hamcrest
Matcher . |
ResultMatcher |
ContentResultMatchers.xml(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) |