public abstract class MockRestResponseCreators extends ObjectSE
ResponseCreator
インスタンスを取得するための静的ファクトリメソッド。Eclipse ユーザー : このクラスを Java エディターのお気に入りとして追加することを検討してください。ナビゲートするには、「設定」を開いて「お気に入り」と入力します。
コンストラクターと説明 |
---|
MockRestResponseCreators() |
修飾子と型 | メソッドと説明 |
---|---|
static DefaultResponseCreator | withBadRequest() 400 レスポンスの ResponseCreator (BAD_REQUEST)。 |
static DefaultResponseCreator | withCreatedEntity(URISE location) 'Location' ヘッダーを持つ 201 レスポンス(作成済み)の ResponseCreator 。 |
static ResponseCreator | withException(IOExceptionSE ex) ResponseCreator と内部アプリケーション IOException |
static DefaultResponseCreator | withNoContent() 204 レスポンスの場合は ResponseCreator (NO_CONTENT)。 |
static DefaultResponseCreator | withServerError() 500 レスポンスの ResponseCreator (SERVER_ERROR)。 |
static DefaultResponseCreator | withStatus(HttpStatus status) 特定の HTTP ステータスを持つ ResponseCreator 。 |
static DefaultResponseCreator | withSuccess() 200 レスポンスの ResponseCreator (OK)。 |
static DefaultResponseCreator | withSuccess(byte[] body, MediaType contentType) byte[] 本体の 200 レスポンス(OK)の ResponseCreator 。 |
static DefaultResponseCreator | withSuccess(Resource body, MediaType contentType) Resource ベースのボディを持つ 200 レスポンス(OK)コンテンツの ResponseCreator 。 |
static DefaultResponseCreator | withSuccess(StringSE body, MediaType contentType) ストリング本体の 200 レスポンス(OK)の ResponseCreator 。 |
static DefaultResponseCreator | withUnauthorizedRequest() 401 レスポンス用の ResponseCreator (未承認)。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public static DefaultResponseCreator withSuccess()
ResponseCreator
(OK)。public static DefaultResponseCreator withSuccess(StringSE body, @Nullable MediaType contentType)
ResponseCreator
。body
- レスポンス本文、"UTF-8" 文字列 contentType
- コンテンツの種類 (null
の場合があります)public static DefaultResponseCreator withSuccess(byte[] body, @Nullable MediaType contentType)
ResponseCreator
。body
- レスポンス本文 contentType
- コンテンツの種類 (null
の場合があります)public static DefaultResponseCreator withSuccess(Resource body, @Nullable MediaType contentType)
Resource
ベースのボディを持つ 200 レスポンス(OK)コンテンツの ResponseCreator
。body
- レスポンス本文 contentType
- コンテンツの種類 (null
の場合があります)public static DefaultResponseCreator withCreatedEntity(URISE location)
ResponseCreator
。location
- Location
ヘッダーの値 public static DefaultResponseCreator withNoContent()
ResponseCreator
(NO_CONTENT)。public static DefaultResponseCreator withBadRequest()
ResponseCreator
(BAD_REQUEST)。public static DefaultResponseCreator withUnauthorizedRequest()
ResponseCreator
(未承認)。public static DefaultResponseCreator withServerError()
ResponseCreator
(SERVER_ERROR)。public static DefaultResponseCreator withStatus(HttpStatus status)
ResponseCreator
。status
- レスポンスステータス public static ResponseCreator withException(IOExceptionSE ex)
ResponseCreator
と内部アプリケーション IOException
例: これを使用して SocketTimeoutException
をシミュレートできます。
ex
- HTTP 呼び出し時にスローされる Exception