public final class ClientDriverRule extends Object implements org.junit.rules.TestRule
| Constructor and Description |
|---|
ClientDriverRule()
Creates a new rule with a driver running on a free port.
|
ClientDriverRule(int port)
Creates a new rule with a driver running on the specified port.
|
| Modifier and Type | Method and Description |
|---|---|
ClientDriverExpectation |
addExpectation(ClientDriverRequest request,
ClientDriverResponse response)
Adds an expectation on the ClientDriver to expect the given request and response.
|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
ClientDriverRule |
expectResponsesWithin(int timeout,
TimeUnit units)
When ClientDriver comes to check for unmatched expectations, it will retry for the specified length of time before considering the expectation unmatched.
|
String |
getBaseUrl()
The base URL of the underlying ClientDriver.
|
int |
getPort()
The port that the underlying ClientDriver is listening too.
|
void |
whenCompleted(ClientDriverCompletedListener listener)
The given listener will be registered with the Client Driver and executes once execution has
completed.
|
public ClientDriverRule()
public ClientDriverRule(int port)
port - The port on which the driver should listenpublic org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
apply in interface org.junit.rules.TestRulepublic ClientDriverExpectation addExpectation(ClientDriverRequest request, ClientDriverResponse response)
request - The request to expectresponse - The response to expectpublic String getBaseUrl()
public int getPort()
public void whenCompleted(ClientDriverCompletedListener listener)
listener - The listenerpublic ClientDriverRule expectResponsesWithin(int timeout, TimeUnit units)
When ClientDriver comes to check for unmatched expectations, it will retry for the specified length of time before considering the expectation unmatched.
Has the effect of calling ClientDriverResponse.within(long, java.util.concurrent.TimeUnit) against each ClientDriverResponse added as an expectation. (Note that a timeout set
explicitly against the ClientDriverResponse overrides the value set here.)
timeout - The timeout expressed in the specified units.units - The TimeUnit that the timeout is expressed in.Copyright © 2014. All Rights Reserved.