public class ContentRequestMatchers
extends java.lang.Object
RequestMatcher
のファクトリ。このクラスのインスタンスには、通常 MockRestRequestMatchers.content()
を介してアクセスします。修飾子 | コンストラクターと説明 |
---|---|
protected | ContentRequestMatchers() 直接インスタンス化用ではなく、クラスコンストラクター。 |
修飾子と型 | メソッドと説明 |
---|---|
RequestMatcher | bytes(byte[] expectedContent) リクエストの本文を指定されたバイト配列と比較します。 |
RequestMatcher | contentType(MediaType expectedContentType) リクエストコンテンツ型を MediaType としてアサートします。 |
RequestMatcher | contentType(java.lang.String expectedContentType) リクエストのコンテンツ型を文字列としてアサートします。 |
RequestMatcher | contentTypeCompatibleWith(MediaType contentType) リクエストコンテンツ型が MediaType.isCompatibleWith(MediaType) で定義されている特定のコンテンツ型と互換性があることをアサートします。 |
RequestMatcher | contentTypeCompatibleWith(java.lang.String contentType) リクエストコンテンツ型が MediaType.isCompatibleWith(MediaType) で定義されている特定のコンテンツ型と互換性があることをアサートします。 |
RequestMatcher | formData(MultiValueMap<java.lang.String,java.lang.String> expectedContent) 本体をフォームデータとして解析し、指定された MultiValueMap と比較します。 |
RequestMatcher | json(java.lang.String expectedJsonContent) 期待される文字列と実際の文字列を JSON として解析し、2 つが「類似している」ことを表明します。 |
RequestMatcher | json(java.lang.String expectedJsonContent, boolean strict) リクエストの本文と指定された文字列を JSON として解析し、2 つが「類似している」ことを表明します。 |
RequestMatcher | node(Matcher<? super org.w3c.dom.Node> matcher) リクエストの内容を Node として解析し、指定された Matcher を適用します。 |
RequestMatcher | source(Matcher<? super javax.xml.transform.Source> matcher) リクエストの内容を DOMSource として解析し、指定された Matcher を適用します。 |
RequestMatcher | string(Matcher<? super java.lang.String> matcher) リクエストの本文を UTF-8 文字列として取得し、指定された Matcher を適用します。 |
RequestMatcher | string(java.lang.String expectedContent) リクエストの本文を UTF-8 文字列として取得し、指定された文字列と比較します。 |
RequestMatcher | xml(java.lang.String expectedXmlContent) リクエストの本文と指定された文字列を XML として解析し、2 つが「類似している」ことを表明します |
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<? super java.lang.String> matcher)
Matcher
を適用します。public RequestMatcher string(java.lang.String expectedContent)
public RequestMatcher bytes(byte[] expectedContent)
public RequestMatcher formData(MultiValueMap<java.lang.String,java.lang.String> expectedContent)
MultiValueMap
と比較します。public RequestMatcher xml(java.lang.String expectedXmlContent)
このマッチャーの使用は、XMLUnit ライブラリが利用可能であることを前提としています。
expectedXmlContent
- 予期される XML コンテンツ public RequestMatcher node(Matcher<? super org.w3c.dom.Node> matcher)
Node
として解析し、指定された Matcher
を適用します。public RequestMatcher source(Matcher<? super javax.xml.transform.Source> matcher)
DOMSource
として解析し、指定された Matcher
を適用します。public RequestMatcher json(java.lang.String expectedJsonContent)
このマッチャーを使用するには、JSONassert ライブラリが必要です。
expectedJsonContent
- 予期される JSON コンテンツ public RequestMatcher json(java.lang.String expectedJsonContent, boolean strict)
strict
パラメーター値に応じて、2 つのモードで比較できます。
true
: 厳格なチェック。拡張可能ではなく、厳密な配列順序。false
: 寛大なチェック。拡張可能な、厳密でない配列の順序。このマッチャーを使用するには、JSONassert ライブラリが必要です。
expectedJsonContent
- 予期される JSON コンテンツ strict
- 厳密なチェックを可能にします