wood burning stoves 2.0*
The moose likes Testing and the fly likes junit test case error 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 "junit test case error" Watch "junit test case error" New topic
Author

junit test case error

ac mohan
Greenhorn

Joined: Jul 11, 2011
Posts: 1
error "java.lang.IllegalStateException: no last call on a mock available" below is the code.

@Test
public void testGetis() {
ServiceProcessResponse response = new ServiceProcessResponse();

response.setStatus("S");
response.setError(null);
ServiceProcessRequest request=new ServiceProcessRequest();
request.setEmailAddress("11");
request.setOrderNumber("123");
expect(DaoImpl.getService().process(
request, null, null)).andReturn(response);
replay(promotionDaoImpl);
DaoImpl.data(anyString(),anyBoolean(), anyBoolean());
verify(DaoImpl);
}
i am getting error at "when" statement line.

can any one help on this please.
Immanuel Marimuthu
Greenhorn

Joined: Oct 20, 2009
Posts: 2
Can you be specific in which line you are getting the error ..sorry I am not getting "when" line...?

Anyway my inputs based on the error message..

Please verify the method that you are mocking in your code is actually having a return type instead of being void..

If it a void...then you can use exceptLastCall method of Mock class and then you can have your desired response..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: junit test case error
 
Similar Threads
How to read JavaScript function from a Jsp
How to automatically display SessionExpired.jsp upon session timeout ?
Problem to initialize the request parameter of the HttpServlet from any JUnit test class
MVC in Visualage ( WTE)
How to use HttpUnit and JsUnit