File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Testing and the fly likes Problem mocking restTemplate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Problem mocking restTemplate" Watch "Problem mocking restTemplate" New topic

Problem mocking restTemplate

Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643
Hi, I am using EasyMock for mocking and i am having problem while mocking restTemplate . My class calls "exchange" method of restTemplate which returns responseEntity<String> . Here is the method i want to test. Whenever i run the junit for this , it retuns an error message saying 7 methods expected and 5 recorded. I am using Spring 3.0.2

please suggest any solution to write a junit for this method.
I agree. Here's the link:
subject: Problem mocking restTemplate
Similar Threads
Create a new object in db using Post with Spring3 RestTemplate
Resteasy and Spring - howto register javax.xml.bind.ValidationEventHandler
nested exception is org.springframework.web.client.ResourceAccessException: I/O error
org.springframework.web.client.ResourceAccessException: I/O error: Connection refused: connect
Streaming Xml and well formedness