public class ContentRequestMatchers extends ObjectSE
RequestMatcher
のファクトリ。このクラスのインスタンスには、通常 MockRestRequestMatchers.content()
を介してアクセスします。修飾子 | コンストラクターと説明 |
---|---|
protected | ContentRequestMatchers() 直接インスタンス化用ではなく、クラスコンストラクター。 |
修飾子と型 | メソッドと説明 |
---|---|
RequestMatcher | bytes(byte[] expectedContent) リクエストの本文を指定されたバイト配列と比較します。 |
RequestMatcher | contentType(MediaType expectedContentType) リクエストコンテンツ型を MediaType としてアサートします。 |
RequestMatcher | contentType(StringSE expectedContentType) リクエストのコンテンツ型を文字列としてアサートします。 |
RequestMatcher | contentTypeCompatibleWith(MediaType contentType) リクエストコンテンツ型が MediaType.isCompatibleWith(MediaType) で定義されている特定のコンテンツ型と互換性があることをアサートします。 |
RequestMatcher | contentTypeCompatibleWith(StringSE contentType) リクエストコンテンツ型が MediaType.isCompatibleWith(MediaType) で定義されている特定のコンテンツ型と互換性があることをアサートします。 |
RequestMatcher | formData(MultiValueMap<StringSE, StringSE> expected) 本体をフォームデータとして解析し、指定された MultiValueMap と比較します。 |
RequestMatcher | formDataContains(MapSE<StringSE, StringSE> expected) 予想されるフォームパラメーターの指定されたサブセットと一致する formData(MultiValueMap) のバリアント。 |
RequestMatcher | json(StringSE expectedJsonContent) 期待される文字列と実際の文字列を JSON として解析し、2 つが「類似している」ことを表明します。 |
RequestMatcher | json(StringSE expectedJsonContent, boolean strict) リクエストの本文と指定された文字列を JSON として解析し、2 つが「類似している」ことを表明します。 |
RequestMatcher | multipartData(MultiValueMap<StringSE,?> expectedMap) ボディをマルチパートデータとして解析し、指定された MultiValueMap からの値を正確に含むことをアサートします。 |
RequestMatcher | multipartDataContains(MapSE<StringSE,?> expectedMap) multipartData(MultiValueMap) のバリアント。同じことを行いますが、実際の値のサブセットのみを対象とします。 |
RequestMatcher | node(Matcher<? super NodeSE> matcher) |
RequestMatcher | source(Matcher<? super SourceSE> matcher) リクエストの内容を DOMSource SE として解析し、指定された Matcher を適用します。 |
RequestMatcher | string(Matcher<? super StringSE> matcher) リクエストの本文を UTF-8 文字列として取得し、指定された Matcher を適用します。 |
RequestMatcher | string(StringSE expectedContent) リクエストの本文を UTF-8 文字列として取得し、指定された文字列と比較します。 |
RequestMatcher | xml(StringSE expectedXmlContent) リクエストの本文と指定された文字列を XML として解析し、2 つが「類似している」ことを表明します |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
protected ContentRequestMatchers()
MockRestRequestMatchers.content()
を使用します。public RequestMatcher contentType(StringSE expectedContentType)
public RequestMatcher contentType(MediaType expectedContentType)
MediaType
としてアサートします。public RequestMatcher contentTypeCompatibleWith(StringSE contentType)
MediaType.isCompatibleWith(MediaType)
で定義されている特定のコンテンツ型と互換性があることをアサートします。public RequestMatcher contentTypeCompatibleWith(MediaType contentType)
MediaType.isCompatibleWith(MediaType)
で定義されている特定のコンテンツ型と互換性があることをアサートします。public RequestMatcher string(Matcher<? super StringSE> matcher)
Matcher
を適用します。public RequestMatcher string(StringSE expectedContent)
public RequestMatcher bytes(byte[] expectedContent)
public RequestMatcher formData(MultiValueMap<StringSE,StringSE> expected)
MultiValueMap
と比較します。public RequestMatcher formDataContains(MapSE<StringSE,StringSE> expected)
formData(MultiValueMap)
のバリアント。public RequestMatcher multipartData(MultiValueMap<StringSE,?> expectedMap)
MultiValueMap
の値が正確に含まれていることを表明します。値の型は次のとおりです。String
- フォームフィールド Resource
- ファイルのコンテンツ byte[]
- その他の生のコンテンツ 注意 : このメソッドは、マルチパートデータを解析するために Apache Commons FileUpload ライブラリを使用するため、テストクラスパス上に存在する必要があります。
expectedMap
- 期待されるマルチパート値 public RequestMatcher multipartDataContains(MapSE<StringSE,?> expectedMap)
multipartData(MultiValueMap)
のバリアント。同じことを行いますが、実際の値のサブセットのみを対象とします。expectedMap
- 期待されるマルチパート値 public RequestMatcher xml(StringSE expectedXmlContent)
このマッチャーの使用は、XMLUnit ライブラリが利用可能であることを前提としています。
expectedXmlContent
- 予期される XML コンテンツ public RequestMatcher node(Matcher<? super NodeSE> matcher)
public RequestMatcher source(Matcher<? super SourceSE> matcher)
DOMSource
SE として解析し、指定された Matcher
を適用します。public RequestMatcher json(StringSE expectedJsonContent)
このマッチャーを使用するには、JSONassert ライブラリが必要です。
expectedJsonContent
- 予期される JSON コンテンツ public RequestMatcher json(StringSE expectedJsonContent, boolean strict)
strict
パラメーター値に応じて、2 つのモードで比較できます。
true
: 厳格なチェック。拡張可能ではなく、厳密な配列順序。false
: 寛大なチェック。拡張可能な、厳密でない配列の順序。このマッチャーを使用するには、JSONassert ライブラリが必要です。
expectedJsonContent
- 予期される JSON コンテンツ strict
- 厳密なチェックを可能にします