I have a class which has direct dependency on the RestTemplate. I wish I have a JUnit test of it, offline.
How could I mock a RestTemplate in my unittest?
Sping 3.0 introduced RestTemplate
. Since version 3.2, the Spring MVC test framework has provided the class MockRestServiceServer
for unit testing client REST code.