Before we dive deeper into the inner workings of the price calculator, let's spend a bit of time examining how the two microservice dependencies work; after all, we will need this information to write our tests.
The price microservice provides a REST endpoint for retrieving an item's published price on a particular date. The service responds with a JSON payload that looks like this:
The second microservice in this example is called vat and is also RESTful. It exposes an endpoint for retrieving the VAT rate that was applicable on a particular date. The service responds with a JSON payload as follows:
As you can see, the returned JSON payload is quite simple and it would be trivial for our test code to mock it.