public class ClientDriverRule extends Object implements org.junit.rules.TestRule
| Modifier | Constructor and Description |
|---|---|
|
ClientDriverRule()
Creates a new rule with a driver running on a free port.
|
protected |
ClientDriverRule(ClientDriver clientDriver) |
|
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 |
noFailFastOnUnexpectedRequest()
Make the mock not fail fast on an unexpected request.
|
void |
reset()
Resets the expectations and requests in the handler.
|
void |
verify(ClientDriverRequest clientDriverRequest,
int times)
When you want to verify, that following request was executed, you can use this method.
|
void |
whenCompleted(ClientDriverListener 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 listenprotected ClientDriverRule(ClientDriver clientDriver)
public 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 noFailFastOnUnexpectedRequest()
public void reset()
public void whenCompleted(ClientDriverListener 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.public void verify(ClientDriverRequest clientDriverRequest, int times)
clientDriverRequest - Copyright © 2016. All Rights Reserved.