Reputation: 4004
My method is:
def client = new SOAPClient("http://...")
def response = client.send(
"""<?xml version='1.0' encoding='UTF-8'?>
<soap-env:Envelope xmlns:SOAP='http://schemas.xmlsoap.org/soap/envelope/'>
<soap-env:Body>
<GetFoo>bar</GetFoo>
</soap-env:Body>
</soap-env:Envelope>"""
)
return response.httpResponse.statusCode
SOAPClient is a plugin for Grails.
So in my unit test, how can I mock SOAPClient and its send method?
Upvotes: 0
Views: 226
Reputation: 4622
def client = Mock(SOAPClient)
client.send(_) >> response
Of course you need to create desired response object first.
Upvotes: 2