@Deprecated public class MockRest extends Object implements MockHttpConnection
Allows you to test your REST resource classes without a running servlet container.
| Modifier and Type | Method and Description |
|---|---|
static MockRest |
create(Class<?> c)
Deprecated.
Create a new mock REST interface
|
static MockRest |
create(Class<?> c,
boolean debug)
Deprecated.
Create a new mock REST interface
|
MockServletRequest |
delete(String path)
Deprecated.
Perform a DELETE request.
|
MockServletRequest |
get(String path)
Deprecated.
Perform a GET request.
|
MockServletRequest |
options(String path)
Deprecated.
Perform an OPTIONS request.
|
MockServletRequest |
post(String path,
Object body)
Deprecated.
Perform a POST request.
|
MockServletRequest |
put(String path,
Object body)
Deprecated.
Perform a PUT request.
|
MockServletRequest |
request(String method,
String path)
Deprecated.
Performs a REST request against the REST interface.
|
MockServletRequest |
request(String method,
String path,
Object body)
Deprecated.
Performs a REST request against the REST interface.
|
public static MockRest create(Class<?> c) throws RuntimeException
c - The REST class.RuntimeException - For testing conveniences, this method wraps all exceptions in a RuntimeException so that you can easily define mocks as reusable fields.public static MockRest create(Class<?> c, boolean debug) throws RuntimeException
c - The REST class.debug - If BasicRestLogger for logging.
NoOpRestLogger.RuntimeException - For testing conveniences, this method wraps all exceptions in a RuntimeException so that you can easily define mocks as reusable fields.public MockServletRequest request(String method, String path, Object body) throws Exception
request in interface MockHttpConnectionmethod - The HTTP methodpath - The URI path.body - The body of the request.Exception - Error occurred.public MockServletRequest request(String method, String path) throws Exception
method - The HTTP methodpath - The URI path.Exception - Error occurred.public MockServletRequest get(String path) throws Exception
path - The URI path.Exception - Error occurred.public MockServletRequest put(String path, Object body) throws Exception
path - The URI path.body - The body of the request.Exception - Error occurred.public MockServletRequest post(String path, Object body) throws Exception
path - The URI path.body - The body of the request.Exception - Error occurred.public MockServletRequest delete(String path) throws Exception
path - The URI path.Exception - Error occurred.public MockServletRequest options(String path) throws Exception
path - The URI path.Exception - Error occurred.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.