How would you call a JUnit test that calls an external service ?
-> An integration test, why not…
How about a JUnit test that replaces the implementation of the repository layer by a mock ?
-> An unit test, fine.
Would you appreciate to write an unit test that simulates the integration without the pain of recording the response by yourself ?
With a very small boilerplate code, you can do a DIY© implementation of that.
No additional framework, no surprise.
This program will save the mocks inside target/test-classes/rest-template-mocks.
Once satisfied, copy them all inside src/test/resources/rest-template-mocks
There you are, the tests will always be using the mocks. And always green (maybe).
It is written in Kotlin but you can get the Java version in no time