Producer -> Consumer
RESTful web service with Spring WebFlux that gets consumed by service with a WebClient.
See the SpringConsumerTests for the consumer side.
Object <> Entity <> Controller <> Service <> Repository <> Api / UI
- Inside out testing : Left to right
- Outside in testing : Right to Left ( - for more difficult integrations)
- Build a test
- Write the code to satisfy the test
- Repeat
Mockito is an open source testing framework for Java. It allows the creation of test double objects (mock objects) in automated unit tests for the purpose of test-driven development.
When using wiremock to mock producer data there is no way to tell if there are fields that no longer exist in the api you consume data from. To detect this we can use a contract that defines a relation you expect to exist.
application.properties:
spring.data.mongodb.uri= <Uri provided by atlas>
spring.data.mongodb.database= <Database name>
application.properties:
spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.database= <Database name>