public ResultMatcher contentType(java.lang.String contentType)
Assert the ServletResponse content type. The given content type must
fully match including type, sub-type, and parameters. For checking
only the type and sub-type see contentTypeCompatibleWith(String).
Assert the ServletResponse content type after parsing it as a MediaType.
The given content type must fully match including type, sub-type, and
parameters. For checking only the type and sub-type see
contentTypeCompatibleWith(MediaType).
contentTypeCompatibleWith
public ResultMatcher contentTypeCompatibleWith(java.lang.String contentType)
public ResultMatcher xml(java.lang.String xmlContent)
Parse the response content and the given string as XML and assert the two
are "similar" - i.e. they contain the same elements and attributes
regardless of order.
public ResultMatcher json(java.lang.String jsonContent)
Parse the expected and actual strings as JSON and assert the two
are "similar" - i.e. they contain the same attribute-value pairs
regardless of formatting with a lenient checking (extensible, and non-strict array
ordering).
Parameters:
jsonContent - the expected JSON content
Since:
4.1
json
public ResultMatcher 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. they contain the same attribute-value pairs regardless of formatting.
Can compare in two modes, depending on strict parameter value:
true: strict checking. Not extensible, and strict array ordering.
false: lenient checking. Extensible, and non-strict array ordering.
Use of this matcher requires the JSONassert library.