Package com.yahoo.restapi
Class RestApiTestDriver
- java.lang.Object
-
- com.yahoo.restapi.RestApiTestDriver
-
- All Implemented Interfaces:
AutoCloseable
public class RestApiTestDriver extends Object implements AutoCloseable
Test driver forRestApi
- Author:
- bjorncs
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RestApiTestDriver.Builder
static interface
RestApiTestDriver.RestApiRequestHandlerFactory
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static ThreadedHttpRequestHandler.Context
createHandlerTestContext()
HttpResponse
executeRequest(HttpRequest request)
RestApiRequestHandler<?>
handler()
com.fasterxml.jackson.databind.ObjectMapper
jacksonJsonMapper()
OptionalInt
listenPort()
static RestApiTestDriver.Builder
newBuilder(RestApiRequestHandler<?> handler)
static RestApiTestDriver.Builder
newBuilder(RestApiTestDriver.RestApiRequestHandlerFactory factory)
<T> T
parseJacksonResponseContent(HttpResponse response, com.fasterxml.jackson.core.type.TypeReference<T> type)
<T> T
parseJacksonResponseContent(HttpResponse response, Class<T> type)
InputStream
requestContentOf(Object jacksonEntity)
RestApi
restApi()
-
-
-
Method Detail
-
newBuilder
public static RestApiTestDriver.Builder newBuilder(RestApiRequestHandler<?> handler)
-
newBuilder
public static RestApiTestDriver.Builder newBuilder(RestApiTestDriver.RestApiRequestHandlerFactory factory)
-
createHandlerTestContext
public static ThreadedHttpRequestHandler.Context createHandlerTestContext()
-
listenPort
public OptionalInt listenPort()
-
handler
public RestApiRequestHandler<?> handler()
-
restApi
public RestApi restApi()
-
jacksonJsonMapper
public com.fasterxml.jackson.databind.ObjectMapper jacksonJsonMapper()
-
executeRequest
public HttpResponse executeRequest(HttpRequest request)
-
requestContentOf
public InputStream requestContentOf(Object jacksonEntity)
-
parseJacksonResponseContent
public <T> T parseJacksonResponseContent(HttpResponse response, com.fasterxml.jackson.core.type.TypeReference<T> type)
-
parseJacksonResponseContent
public <T> T parseJacksonResponseContent(HttpResponse response, Class<T> type)
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
-