public abstract class AbstractTest extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractTest.Service |
Modifier and Type | Field and Description |
---|---|
protected static String |
JSON_ACCESS |
protected static String |
JSON_TOKEN |
protected OSClient.OSClientV2 |
osv2 |
protected OSClient.OSClientV3 |
osv3 |
protected okhttp3.mockwebserver.MockWebServer |
server |
protected static String |
TOKEN_ID |
Constructor and Description |
---|
AbstractTest() |
Modifier and Type | Method and Description |
---|---|
protected void |
afterTest() |
protected void |
associateClientV2(OSClient.OSClientV2 osv2) |
protected void |
associateClientV3(OSClient.OSClientV3 osv3) |
protected String |
authURL(String path) |
protected String |
getResource(String resource) |
protected OSClient.OSClientV2 |
osv2() |
protected OSClient.OSClientV3 |
osv3() |
protected void |
respondWith(int statusCode)
Responds with specified status code and no body
|
protected void |
respondWith(int statusCode,
String jsonBody)
Responds with specified status code and json body
|
protected void |
respondWith(Map<String,String> headers,
int statusCode)
Responds with specified status code, no body and optional headers
|
protected void |
respondWith(Map<String,String> headers,
int statusCode,
String body)
Responds with specified status code, body and optional headers
|
protected void |
respondWith(String resource)
Responds with success status code and body from json resource file
|
protected void |
respondWithCodeAndResource(int statusCode,
String resource) |
protected void |
respondWithHeaderAndResource(Map<String,String> headers,
int statusCode,
String resource)
Responds with given header, status code, body from json resource file.
|
protected abstract AbstractTest.Service |
service() |
protected void |
startServer() |
protected okhttp3.mockwebserver.RecordedRequest |
takeRequest()
Awaits, removes and returns the next request made to the mock server.
|
protected static final String JSON_ACCESS
protected static final String JSON_TOKEN
protected static final String TOKEN_ID
protected OSClient.OSClientV2 osv2
protected OSClient.OSClientV3 osv3
protected okhttp3.mockwebserver.MockWebServer server
protected abstract AbstractTest.Service service()
protected void startServer() throws UnknownHostException
UnknownHostException
protected void respondWith(String resource) throws IOException
resource
- the json resource fileIOException
- Signals that an I/O exception has occurred.protected void respondWith(int statusCode)
statusCode
- the status code to respond withprotected void respondWith(Map<String,String> headers, int statusCode)
headers
- optional headersstatusCode
- the status code to respond withprotected void respondWith(int statusCode, String jsonBody)
statusCode
- the status code to respond withjsonBody
- the json bodyprotected void respondWith(Map<String,String> headers, int statusCode, String body)
headers
- optional headersstatusCode
- the status code to respond withbody
- the response bodyprotected void respondWithHeaderAndResource(Map<String,String> headers, int statusCode, String resource) throws IOException
headers
- the specified headerstatusCode
- the status code to respond withresource
- the json resource fileIOException
- Signals that an I/O exception has occurredprotected void respondWithCodeAndResource(int statusCode, String resource) throws IOException
IOException
protected okhttp3.mockwebserver.RecordedRequest takeRequest() throws InterruptedException
InterruptedException
protected void afterTest()
protected void associateClientV2(OSClient.OSClientV2 osv2)
protected void associateClientV3(OSClient.OSClientV3 osv3)
protected OSClient.OSClientV2 osv2()
protected OSClient.OSClientV3 osv3()
protected String getResource(String resource) throws IOException
IOException
Copyright © 2017. All Rights Reserved.