public abstract class MockRestResponseCreators extends Object
ResponseCreator
instance.
Eclipse users: consider adding this class as a Java editor favorite. To navigate, open the Preferences and type "favorites".
Modifier and Type | Method and Description |
---|---|
static DefaultResponseCreator |
withBadRequest()
ResponseCreator for a 400 response (BAD_REQUEST). |
static DefaultResponseCreator |
withCreatedEntity(URI location)
ResponseCreator for a 201 response (CREATED) with a 'Location' header. |
static DefaultResponseCreator |
withNoContent()
ResponseCreator for a 204 response (NO_CONTENT). |
static DefaultResponseCreator |
withServerError()
ResponseCreator for a 500 response (SERVER_ERROR). |
static DefaultResponseCreator |
withStatus(HttpStatus status)
ResponseCreator with a specific HTTP status. |
static DefaultResponseCreator |
withSuccess()
ResponseCreator for a 200 response (OK). |
static DefaultResponseCreator |
withSuccess(byte[] body,
MediaType contentType)
ResponseCreator for a 200 response (OK) with byte[] body. |
static DefaultResponseCreator |
withSuccess(Resource body,
MediaType contentType)
ResponseCreator for a 200 response (OK) content with Resource -based body. |
static DefaultResponseCreator |
withSuccess(String body,
MediaType mediaType)
ResponseCreator for a 200 response (OK) with String body. |
static DefaultResponseCreator |
withUnauthorizedRequest()
ResponseCreator for a 401 response (UNAUTHORIZED). |
public static DefaultResponseCreator withSuccess()
ResponseCreator
for a 200 response (OK).public static DefaultResponseCreator withSuccess(String body, MediaType mediaType)
ResponseCreator
for a 200 response (OK) with String body.body
- the response body, a "UTF-8" stringmediaType
- the type of the content, may be null
public static DefaultResponseCreator withSuccess(byte[] body, MediaType contentType)
ResponseCreator
for a 200 response (OK) with byte[] body.body
- the response bodycontentType
- the type of the content, may be null
public static DefaultResponseCreator withSuccess(Resource body, MediaType contentType)
ResponseCreator
for a 200 response (OK) content with Resource
-based body.body
- the response bodycontentType
- the type of the content, may be null
public static DefaultResponseCreator withCreatedEntity(URI location)
ResponseCreator
for a 201 response (CREATED) with a 'Location' header.location
- the value for the Location
headerpublic static DefaultResponseCreator withNoContent()
ResponseCreator
for a 204 response (NO_CONTENT).public static DefaultResponseCreator withBadRequest()
ResponseCreator
for a 400 response (BAD_REQUEST).public static DefaultResponseCreator withUnauthorizedRequest()
ResponseCreator
for a 401 response (UNAUTHORIZED).public static DefaultResponseCreator withServerError()
ResponseCreator
for a 500 response (SERVER_ERROR).public static DefaultResponseCreator withStatus(HttpStatus status)
ResponseCreator
with a specific HTTP status.status
- the response status