Results 1 to 2 of 2

Thread: MockWebServiceServer - multiple calls

Hybrid View

  1. #1

    Default 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. #2

    Default

    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 at 10:34 PM.

Tags for this Thread

Posting Permissions

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