Example WireMock Recorder
This is a proof of concept to show how WireMock can be used to manage connections to a third party server in a way that maximizes the conformity to its API while reducing the dependency of the code to it for tasks such as testing and local development.
For an in detail explanation of the whole setup, see this post: https://hceris.com/recording-apis-with-wiremock/
Requirements to run this app
- Java 8
- A working internet connection
- Confirm that the connection to the Third Party Server works through an automated test
- Have unit tests that do not rely on external resources, but that use mock data using an external source
- Have a way to easily refresh the test data in an automated way, to confirm that the mock data is compatible with the source
- Use the same mocks for local development without any extra configuration or dependencies needed
This is a diagram how it all ties together
The app exposes two routes
They go against a real API
There is a comprehensive script to run everything in the app. When run without arguments, it displays all the possible targets.