Class TestResource
java.lang.Object
com.reallifedeveloper.common.resource.BaseResource
com.reallifedeveloper.common.resource.TestResource
A JAX-RS resource that can be used for testing REST clients. This resource accepts all requests,
and you can specify the responses given using the
reset(Response...)
method.
See TestResourceTest
for an example of how to use this class.
- Author:
- RealLifeDeveloper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Information about an HTTP request. -
Field Summary
Fields inherited from class com.reallifedeveloper.common.resource.BaseResource
API_KEY_HTTP_HEADER, API_KEY_QUERY_PARAMETER, CACHE_1_HOUR, DATE_FORMAT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.Response
jakarta.ws.rs.core.Response
jakarta.ws.rs.core.Response
jakarta.ws.rs.core.Response
jakarta.ws.rs.core.Response
jakarta.ws.rs.core.Response
requests()
Gives a list ofTestResource.RequestInfo
objects representing the requests that have reached this resource.void
reset
(jakarta.ws.rs.core.Response... newResponses) Resets the resource so that it starts to respond with the given responses.Methods inherited from class com.reallifedeveloper.common.resource.BaseResource
commaSeparatedStringToList, handleError, logger, parseDate, parseUrl
-
Constructor Details
-
TestResource
public TestResource()
-
-
Method Details
-
get
-
post
-
put
-
delete
-
head
-
options
-
reset
public void reset(jakarta.ws.rs.core.Response... newResponses) Resets the resource so that it starts to respond with the given responses.- Parameters:
newResponses
- the responses to give
-
requests
Gives a list ofTestResource.RequestInfo
objects representing the requests that have reached this resource.- Returns:
- a list of
RequestInfo
objects
-