public class ContentRequestMatchers
extends java.lang.Object
RequestMatcher
's. An instance of this
class is typically accessed via MockRestRequestMatchers.content()
.Modifier and Type | Class and Description |
---|---|
private static class |
ContentRequestMatchers.AbstractXmlRequestMatcher
Abstract base class for XML
RequestMatcher 's. |
Modifier and Type | Field and Description |
---|---|
private XmlExpectationsHelper |
xmlHelper |
Modifier | Constructor and Description |
---|---|
protected |
ContentRequestMatchers()
Class constructor, not for direct instantiation.
|
Modifier and Type | Method and Description |
---|---|
RequestMatcher |
bytes(byte[] expectedContent)
Compare the body of the request to the given byte array.
|
RequestMatcher |
contentType(MediaType expectedContentType)
Assert the request content type as a
MediaType . |
RequestMatcher |
contentType(java.lang.String expectedContentType)
Assert the request content type as a String.
|
RequestMatcher |
contentTypeCompatibleWith(MediaType contentType)
Assert the request content type is compatible with the given
content type as defined by
MediaType.isCompatibleWith(MediaType) . |
RequestMatcher |
contentTypeCompatibleWith(java.lang.String contentType)
Assert the request content type is compatible with the given
content type as defined by
MediaType.isCompatibleWith(MediaType) . |
RequestMatcher |
node(
Parse the request content as
Node and apply the given Matcher . |
RequestMatcher |
source(
Parse the request content as
DOMSource and apply the given Matcher . |
RequestMatcher |
string(
Get the body of the request as a UTF-8 string and appply the given
Matcher . |
RequestMatcher |
xml(java.lang.String expectedXmlContent)
Parse the request body and the given String as XML and assert that the
two are "similar" - i.e.
|
private final XmlExpectationsHelper xmlHelper
protected ContentRequestMatchers()
MockRestRequestMatchers.content()
.public RequestMatcher contentType(java.lang.String expectedContentType)
public RequestMatcher contentType(MediaType expectedContentType)
MediaType
.public RequestMatcher contentTypeCompatibleWith(java.lang.String contentType)
MediaType.isCompatibleWith(MediaType)
.public RequestMatcher contentTypeCompatibleWith(MediaType contentType)
MediaType.isCompatibleWith(MediaType)
.public RequestMatcher string(matcher)
Matcher
.public RequestMatcher bytes(byte[] expectedContent)
public RequestMatcher xml(java.lang.String expectedXmlContent)
Use of this matcher assumes the XMLUnit library is available.
expectedXmlContent
- the expected XML contentpublic RequestMatcher node(matcher)
Node
and apply the given Matcher
.public RequestMatcher source(matcher)
DOMSource
and apply the given Matcher
.