Package net.officefloor.woof.mock
Class MockWoofServer.MockWoofResponseImpl
- java.lang.Object
-
- net.officefloor.server.http.mock.MockHttpServer.MockHttpResponseImpl
-
- net.officefloor.woof.mock.MockWoofServer.MockWoofResponseImpl
-
- All Implemented Interfaces:
MockHttpResponse
,MockWoofResponse
- Enclosing class:
- MockWoofServer
protected class MockWoofServer.MockWoofResponseImpl extends MockHttpServer.MockHttpResponseImpl implements MockWoofResponse
MockWoofResponse
implementation.
-
-
Field Summary
-
Fields inherited from class net.officefloor.server.http.mock.MockHttpServer.MockHttpResponseImpl
cookies, entityInputStream, failure, headers, request, status, version
-
-
Constructor Summary
Constructors Modifier Constructor Description MockWoofResponseImpl(MockHttpServer.MockHttpRequest request, java.lang.Throwable failure)
protected
MockWoofResponseImpl(MockHttpServer.MockHttpRequest request, HttpVersion version, HttpStatus status, java.util.List<WritableHttpHeader> headers, java.util.List<WritableHttpCookie> cookies, java.io.InputStream entityInputStream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assertJson(int statusCode, java.lang.Object entity, com.fasterxml.jackson.databind.ObjectMapper mapper, java.lang.String... headerNameValuePairs)
Asserts the JSON response providing customObjectMapper
.void
assertJson(int statusCode, java.lang.Object entity, java.lang.String... headerNameValuePairs)
Asserts the JSON response.void
assertJsonError(int httpStatus, java.lang.Throwable failure, java.lang.String... headerNameValuePairs)
Asserts a JSON error.void
assertJsonError(java.lang.Throwable failure, java.lang.String... headerNameValuePairs)
Asserts a JSON error.<T> T
getJson(int statusCode, java.lang.Class<T> clazz)
Obtains the JSON object from HTTP payload.<T> T
getJson(int statusCode, java.lang.Class<T> clazz, com.fasterxml.jackson.databind.ObjectMapper mapper)
Obtains the JSON object from HTTP payload using customObjectMapper
.-
Methods inherited from class net.officefloor.server.http.mock.MockHttpServer.MockHttpResponseImpl
assertCookie, assertHeader, assertResponse, assertStatus, assertStatus, getCookie, getCookies, getEntity, getEntity, getHeader, getHeaders, getStatus, getVersion
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.officefloor.server.http.mock.MockHttpResponse
assertCookie, assertHeader, assertResponse, assertStatus, assertStatus, getCookie, getCookies, getEntity, getEntity, getHeader, getHeaders, getStatus, getVersion
-
-
-
-
Constructor Detail
-
MockWoofResponseImpl
protected MockWoofResponseImpl(MockHttpServer.MockHttpRequest request, HttpVersion version, HttpStatus status, java.util.List<WritableHttpHeader> headers, java.util.List<WritableHttpCookie> cookies, java.io.InputStream entityInputStream)
-
MockWoofResponseImpl
public MockWoofResponseImpl(MockHttpServer.MockHttpRequest request, java.lang.Throwable failure)
-
-
Method Detail
-
getJson
public <T> T getJson(int statusCode, java.lang.Class<T> clazz)
Description copied from interface:MockWoofResponse
Obtains the JSON object from HTTP payload.- Specified by:
getJson
in interfaceMockWoofResponse
- Type Parameters:
T
- Type of object.- Parameters:
statusCode
-HttpStatus
.clazz
-Class
for the JSON object.- Returns:
- JSON object.
-
getJson
public <T> T getJson(int statusCode, java.lang.Class<T> clazz, com.fasterxml.jackson.databind.ObjectMapper mapper)
Description copied from interface:MockWoofResponse
Obtains the JSON object from HTTP payload using customObjectMapper
.- Specified by:
getJson
in interfaceMockWoofResponse
- Type Parameters:
T
- Type of object.- Parameters:
statusCode
-HttpStatus
.clazz
-Class
for the JSON object.mapper
- CustomObjectMapper
.- Returns:
- JSON object.
-
assertJson
public void assertJson(int statusCode, java.lang.Object entity, java.lang.String... headerNameValuePairs)
Description copied from interface:MockWoofResponse
Asserts the JSON response.- Specified by:
assertJson
in interfaceMockWoofResponse
- Parameters:
statusCode
-HttpStatus
.entity
-Object
to be written as JSON.headerNameValuePairs
- ExpectedHttpHeader
name/value pairs.
-
assertJson
public void assertJson(int statusCode, java.lang.Object entity, com.fasterxml.jackson.databind.ObjectMapper mapper, java.lang.String... headerNameValuePairs)
Description copied from interface:MockWoofResponse
Asserts the JSON response providing customObjectMapper
.- Specified by:
assertJson
in interfaceMockWoofResponse
- Parameters:
statusCode
-HttpStatus
.entity
-Object
to be written as JSON.mapper
- CustomObjectMapper
.headerNameValuePairs
- ExpectedHttpHeader
name/value pairs.
-
assertJsonError
public void assertJsonError(java.lang.Throwable failure, java.lang.String... headerNameValuePairs)
Description copied from interface:MockWoofResponse
Asserts a JSON error.- Specified by:
assertJsonError
in interfaceMockWoofResponse
- Parameters:
failure
- Cause.headerNameValuePairs
- ExpectedHttpHeader
name/value pairs.
-
assertJsonError
public void assertJsonError(int httpStatus, java.lang.Throwable failure, java.lang.String... headerNameValuePairs)
Description copied from interface:MockWoofResponse
Asserts a JSON error.- Specified by:
assertJsonError
in interfaceMockWoofResponse
- Parameters:
httpStatus
- ExpectedHttpStatus
.failure
- Cause.headerNameValuePairs
- ExpectedHttpHeader
name/value pairs.
-
-