My project includes various of spring boot @Service
s which use third-party APIs.
We've written a mocked class for every such service and we run the system test in such way that Spring Boot chooses the mocked classes rather than the real ones (using @Profile("test")
).
The motivation for that was:
- Test only logic (even though this can be done with unit-tests)
- Test empirically the system is thread-safe
- We can't use extensively our APIs (rate limits), but we want to run our system on a sufficiently large amount of items.
My questions:
- Would you advocate this approach for a system test? (all components are mocked)
- If so, can a mocking framework like Mockito do that? The whole point of Mockito is not writing the mocked classes on your own, but how can it be accomplished for a system test where a service is used by multiple beans?