Can I override RESTClient default “HttpResponseException” response to >399 Return Codes?
I'm using the Groovy RESTClient class to do write some (spock) Acceptance tests for Java WebServices I've been authoring. One frustration I've had is in testing the responses... 200 Status's are easy: when: def result = callServiceWithValidParams() then: result.status == 200 But with 400+ I'm forced to either wrap in a try-catch , or test for the HttpResponseException that RESTClient throws by default. when: callWithInvalidParams() then: def e = thrown(Exception) e.message == 'Bad Request' This is sort-of OK, if a little frustrating... but I want to do better. Ideally, I want my tests to more