Package net.officefloor.server.http.mock
Interface MockHttpResponse
-
- All Known Subinterfaces:
MockWoofResponse
- All Known Implementing Classes:
MockHttpServer.MockHttpResponseImpl,MockWoofServer.MockWoofResponseImpl
public interface MockHttpResponseMockHttpResponse.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidassertCookie(HttpResponseCookie cookie)Asserts contains theWritableHttpCookie.voidassertHeader(java.lang.String name, java.lang.String value)Asserts contains theHttpHeader.voidassertResponse(int statusCode, java.lang.String entity, java.lang.String... headerNameValuePairs)Asserts the contents of theHttpResponse.voidassertStatus(int statusCode)Assets the status of theHttpResponse.voidassertStatus(HttpStatus status)Assets theHttpStatusof theHttpResponse.WritableHttpCookiegetCookie(java.lang.String name)Obtains theWritableHttpCookieby the name.java.util.List<WritableHttpCookie>getCookies()Obtains the responseWritableHttpCookieinstances.java.io.InputStreamgetEntity()ObtainsInputStreamto the response HTTP entity.java.lang.StringgetEntity(java.nio.charset.Charset charset)Obtains the HTTP entity as text.WritableHttpHeadergetHeader(java.lang.String name)Obtains the firstWritableHttpHeaderby the name.java.util.List<WritableHttpHeader>getHeaders()Obtains the responseWritableHttpHeaderinstances.HttpStatusgetStatus()Obtains theHttpStatus.HttpVersiongetVersion()Obtains theHttpVersion.
-
-
-
Method Detail
-
getVersion
HttpVersion getVersion()
Obtains theHttpVersion.- Returns:
HttpVersion.
-
getStatus
HttpStatus getStatus()
Obtains theHttpStatus.- Returns:
HttpStatus.
-
getHeader
WritableHttpHeader getHeader(java.lang.String name)
Obtains the firstWritableHttpHeaderby the name.- Parameters:
name- Name of theWritableHttpHeader.- Returns:
- First
WritableHttpHeaderby the name, ornullif noWritableHttpHeaderby the name.
-
assertStatus
void assertStatus(int statusCode)
Assets the status of theHttpResponse.- Parameters:
statusCode- Status code.
-
assertStatus
void assertStatus(HttpStatus status)
Assets theHttpStatusof theHttpResponse.- Parameters:
status-HttpStatus.
-
getHeaders
java.util.List<WritableHttpHeader> getHeaders()
Obtains the responseWritableHttpHeaderinstances.- Returns:
WritableHttpHeaderinstances.
-
assertResponse
void assertResponse(int statusCode, java.lang.String entity, java.lang.String... headerNameValuePairs)Asserts the contents of theHttpResponse.- Parameters:
statusCode- Expected status code.entity- Expected entity.headerNameValuePairs- ExpectedHttpHeadername/value pairs. This only confirms they exist on theHttpResponse. It is not inclusive to check if these are the onlyHttpHeaderinstances.
-
assertHeader
void assertHeader(java.lang.String name, java.lang.String value)Asserts contains theHttpHeader.- Parameters:
name- Expected name.value- Expected value.
-
getCookie
WritableHttpCookie getCookie(java.lang.String name)
Obtains theWritableHttpCookieby the name.- Parameters:
name- Name of theWritableHttpCookie.- Returns:
WritableHttpCookieby the name, ornullif noWritableHttpCookieby the name.
-
getCookies
java.util.List<WritableHttpCookie> getCookies()
Obtains the responseWritableHttpCookieinstances.- Returns:
WritableHttpCookieinstances.
-
assertCookie
void assertCookie(HttpResponseCookie cookie)
Asserts contains theWritableHttpCookie.- Parameters:
cookie- ExpectedWritableHttpCookie.- See Also:
MockHttpServer.mockResponseCookie(String, String)
-
getEntity
java.io.InputStream getEntity()
ObtainsInputStreamto the response HTTP entity.- Returns:
InputStreamto the response HTTP entity.
-
getEntity
java.lang.String getEntity(java.nio.charset.Charset charset)
Obtains the HTTP entity as text.- Parameters:
charset-Charsetfor HTTP entity. May benullto use defaultCharset.- Returns:
- Text of the HTTP entity.
-
-