Clone this wiki locally
The rest-client-driver is a library which simulates a RESTful service. You can set expectations on the HTTP requests you want to receive during a test.
<dependency> <groupId>com.github.rest-driver</groupId> <artifactId>rest-client-driver</artifactId> <version>2.0.0</version> <scope>test</scope> </dependency>
We use JUnit's
@Rule annotation to add the client-driver to a test.
@Rule public ClientDriverRule driver = new ClientDriverRule();
The driver will have all expectations cleared before each test. In your test you can add expectations to the driver:
At present the expectations are matched without considering the order and one expectation must be added for each URL that is called.
At the end of each test the driver checks whether there were any requests made that it wasn't expecting or whether any of the requests it did expect were unfulfilled. If there is any discrepancy it throws an instance of