Announcement Announcement Module
Collapse
No announcement yet.
MockWebServiceServer - multiple calls Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MockWebServiceServer - multiple calls

    Hello,

    I have a JUnit test which utilises a MockWebServiceServer.

    The issue is that within the scope of the test, the MockWebServiceServer object gets called twice with different payloads.

    If I use .expect(anything()) to define the object within the test, the test fails with a "No further connections expected" message when the MockWebServiceServer is called for the second time.

    Is there any way I can record more than one expectation against a MockWebServiceServer object? Or do I have to define more than one?

    Thanks in advance for any assistance.

  • #2
    Fixed - just add additional expectations to the MockWebServiceServer object:

    Code:
    myMockWebServiceServer.expect(payload(myFirstRequest)).andRespond(withPayload(myFirstResponse));
    myMockWebServiceServer.expect(payload(mySecondRequest)).andRespond(withPayload(mySecondResponse));
    Last edited by HatesThatWantsThis; May 2nd, 2012, 10:34 PM.

    Comment

    Working...
    X