Better Integration Testing with MockWebServer

General News

Summary

The intention was to write an integration test that did not touch the inside of the code, but only the edges. Spring Boot 2.2.6 introduced the @DynamicPropertySource which allows you to insert the MockWebServer url into the properties at runtime. Better still, it enables you to test the token caching functionality that comes built into WebClient, but we won’t get to that today. Setting the addFilters to false turns off security so you don’t have to pass an auth token to call your endpoint. You can see that our application code added the /api/clock/alarms path to the end of the base url when it calls the backend.

Classifications

industries
No industries detected
applications
EduTech - learning

AskAI Classifications

Labels
Developer Tools DevOps Software SaaS

Linked Companies

GitHub, Inc.
$1M to $5M
CloudBoost
up to $1M