public class MockClientHttpRequest extends MockHttpOutputMessage implements ClientHttpRequest
ClientHttpRequest
のモック実装。コンストラクターと説明 |
---|
MockClientHttpRequest() デフォルトコンストラクター。 |
MockClientHttpRequest(HttpMethod httpMethod, URISE uri) 指定された HttpMethod と URI でインスタンスを作成します。 |
修飾子と型 | メソッドと説明 |
---|---|
ClientHttpResponse | execute() |
protected ClientHttpResponse | executeInternal() デフォルトの実装は、構成された response を返します。 |
HttpMethod | getMethod() リクエストの HTTP メソッドを返します。 |
StringSE | getMethodValue() リクエストの HTTP メソッドを文字列値として返します。 |
URISE | getURI() リクエストの URI を返します(もしあればクエリ文字列を含みますが、URI 表現のために整形式である場合のみ)。 |
boolean | isExecuted() |
void | setMethod(HttpMethod httpMethod) |
void | setResponse(ClientHttpResponse clientHttpResponse) |
void | setURI(URISE uri) |
StringSE | toString() |
getBody, getBodyAsBytes, getBodyAsString, getBodyAsString, getHeaders
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, waitSE, waitSE, waitSE
getBody
getHeaders
public MockClientHttpRequest()
public MockClientHttpRequest(HttpMethod httpMethod, URISE uri)
public void setMethod(HttpMethod httpMethod)
public HttpMethod getMethod()
HttpRequest
HttpRequest
の getMethod
null
(たとえば非標準の HTTP メソッドの場合)HttpRequest.getMethodValue()
, HttpMethod.resolve(String)
public StringSE getMethodValue()
HttpRequest
HttpRequest
の getMethodValue
HttpRequest.getMethod()
public void setURI(URISE uri)
public URISE getURI()
HttpRequest
HttpRequest
の getURI
null
)public void setResponse(ClientHttpResponse clientHttpResponse)
public boolean isExecuted()
public final ClientHttpResponse execute() throws IOExceptionSE
ClientHttpRequest
の execute
IOExceptionSE
- I/O エラーの場合 executeInternal()
protected ClientHttpResponse executeInternal() throws IOExceptionSE
response
を返します。このメソッドをオーバーライドしてリクエストを実行し、構成されたレスポンスとは異なる可能性のあるレスポンスを提供します。
public StringSE toString()
ObjectSE
の toStringSE