Results 1 to 8 of 8
  1. #1
    acmohan is offline Member
    Join Date
    Jul 2011
    Posts
    26
    Rep Power
    0

    Post junit test case error

    i am learning junit test cases.when i tried to run junit test case i got this error: "java.lang.IllegalStateException: no last call on a mock available" below is the code.

    @Before
    public void setUp(){
    DaoImpl.SetService(mock(Service.class));
    }


    @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 "expect" statement line.

    here when i say return(response) ,it s returning null instead of what i have defined.

    can any one help on this please.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,854
    Rep Power
    19

    Default

    Why post this in two places?
    Was your other thread not good enough?

  3. #3
    acmohan is offline Member
    Join Date
    Jul 2011
    Posts
    26
    Rep Power
    0

    Default

    that's different one.so removed it and made a new post.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,854
    Rep Power
    19

    Default

    Looks the same to me...

  5. #5
    acmohan is offline Member
    Join Date
    Jul 2011
    Posts
    26
    Rep Power
    0

    Default

    can i get any suggestions for my query.I am looking for it.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,854
    Rep Power
    19

    Default

    Maybe if you answer the questions I left on the other thread, since they apply here as well...

  7. #7
    acmohan is offline Member
    Join Date
    Jul 2011
    Posts
    26
    Rep Power
    0

    Default

    i have posted details to that thread.

  8. #8
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    I suggest sticking/merging your two threads because its a little confusing to the people that are trying to help you when you refer to other threads without links in your posts.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

Similar Threads

  1. JUnit test - AssertEquals
    By dellacpa in forum New To Java
    Replies: 2
    Last Post: 11-21-2010, 09:19 PM
  2. junit test problem
    By moamen in forum Eclipse
    Replies: 2
    Last Post: 03-14-2010, 09:41 PM
  3. Replies: 1
    Last Post: 08-03-2009, 05:31 PM
  4. JUnit Test Help!
    By pharo in forum New To Java
    Replies: 0
    Last Post: 04-10-2009, 05:15 PM
  5. Junit test
    By alice in forum New To Java
    Replies: 1
    Last Post: 06-14-2008, 01:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •