Two Laptop Bag
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
JavaRanch » Java Forums » Engineering » Testing
Bookmark "junit test case error" Watch "junit test case error" New topic

junit test case error

ac mohan

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

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

ServiceProcessRequest request=new ServiceProcessRequest();
request, null, null)).andReturn(response);
replay(promotionDaoImpl);,anyBoolean(), anyBoolean());
i am getting error at "when" statement line.

can any one help on this please.
Immanuel Marimuthu

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:
subject: junit test case error
It's not a secret anymore!