public abstract class AbstractRequestExpectationManager extends ObjectSE implements RequestExpectationManager
RequestExpectationManager 実装の基本クラス。サブクラスは、宣言の順序に従っているかどうかに応じて、期待に一致させることによって各リクエストを検証する責任があります。
| 修飾子と型 | クラスと説明 |
|---|---|
protected static class | AbstractRequestExpectationManager.RequestExpectationGroup 残りの期待のグループを管理するヘルパークラス。 |
| コンストラクターと説明 |
|---|
AbstractRequestExpectationManager() |
| 修飾子と型 | メソッドと説明 |
|---|---|
protected void | afterExpectationsDeclared() 最初の実際のリクエスト時に呼び出されます。これは事実上、期待宣言フェーズが終了したことを意味します。 |
protected AssertionErrorSE | createUnexpectedRequestError(ClientHttpRequest request) サブクラスが予期しないリクエストに対して発生させることができる AssertionError を返します。 |
ResponseActions | expectRequest(ExpectedCount count, RequestMatcher matcher) 新しいリクエストの期待を設定します。 |
protected ListSE<RequestExpectation> | getExpectations() 期待値の読み取り専用リストを返します。 |
protected StringSE | getRequestDetails() 実行されたリクエストの詳細を返します。 |
protected ListSE<ClientHttpRequest> | getRequests() これまでに実行されたリクエストの読み取り専用リストを返します。 |
protected RequestExpectation | matchRequest(ClientHttpRequest request)5.0.3 以降、サブクラスはリクエストを期待と一致させるために validateRequestInternal(ClientHttpRequest) ではなくこのメソッドを実装する必要があり、別のステップとして(このクラスによって呼び出される)レスポンスを作成する呼び出しを残します。 |
void | reset() すべての期待値と記録されたリクエストを削除して内部状態をリセットします。 |
ClientHttpResponse | validateRequest(ClientHttpRequest request) 宣言された期待に照らして、与えられた実際のリクエストを検証します。 |
protected ClientHttpResponse | validateRequestInternal(ClientHttpRequest request) 使用すべきではありません。 5.0.3 の時点で、サブクラスは代わりに matchRequest(ClientHttpRequest) を実装し、一致する期待値のみを返す必要があり、呼び出しを残して別のステップとしてレスポンスを作成します(このクラスによって呼び出されます)。 |
void | verify() すべての期待が満たされていることを確認します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEprotected ListSE<RequestExpectation> getExpectations()
protected ListSE<ClientHttpRequest> getRequests()
public ResponseActions expectRequest(ExpectedCount count, RequestMatcher matcher)
RequestExpectationManagerResponseActions は、期待値を追加し、レスポンスを定義するために使用されます。 これは MockRestServiceServer.expect(ExpectedCount, RequestMatcher) のデリゲートです。
RequestExpectationManager 内の expectRequest matcher - リクエスト期待 MockRestServiceServer.expect(RequestMatcher), MockRestServiceServer.expect(ExpectedCount, RequestMatcher)public ClientHttpResponse validateRequest(ClientHttpRequest request) throws IOExceptionSE
RequestExpectationManager これは、実際のリクエストに対して MockRestServiceServer で使用されます。
RequestExpectationManager 内の validateRequest request - リクエスト IOExceptionSE - 検証エラーが発生した場合 protected void afterExpectationsDeclared()
@DeprecatedSE @Nullable protected ClientHttpResponse validateRequestInternal(ClientHttpRequest request) throws IOExceptionSE
matchRequest(ClientHttpRequest) を実装し、一致した期待値のみを返し、レスポンスを作成するための呼び出しを別のステップ (このクラスによって呼び出される) として残す必要があります。protected RequestExpectation matchRequest(ClientHttpRequest request) throws IOExceptionSE
validateRequestInternal(ClientHttpRequest) ではなくこのメソッドを実装する必要があり、別のステップとして(このクラスによって呼び出される)レスポンスを作成する呼び出しを残します。request - 現在のリクエスト RequestExpectation.incrementAndValidate() を介して更新されたリクエスト数を持つ一致した期待値。IOExceptionSEpublic void verify()
RequestExpectationManager これは MockRestServiceServer.verify() のデリゲートです。
RequestExpectationManager 内の verify MockRestServiceServer.verify()protected StringSE getRequestDetails()
protected AssertionErrorSE createUnexpectedRequestError(ClientHttpRequest request)
AssertionError を返します。public void reset()
RequestExpectationManager これは MockRestServiceServer.reset() のデリゲートです。
RequestExpectationManager 内の reset MockRestServiceServer.reset()