defaultFault.setFaultCode(SoapFaultDefinition.CLIENT);
resolver.setDefaultFault(defaultFault);
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage message = messageFactory.createMessage();
SoapMessageFactory factory = new SaajSoapMessageFactory(messageFactory);
MessageContext context = new DefaultMessageContext(new SaajSoapMessage(message), factory);
boolean result = resolver.resolveException(context, null, new IllegalArgumentException("bla"));
Assert.assertTrue("resolveException returns false", result);
Assert.assertTrue("Context has no response", context.hasResponse());
SoapMessage response = (SoapMessage) context.getResponse();
Assert.assertTrue("Response has no fault", response.getSoapBody().hasFault());
Soap11Fault fault = (Soap11Fault) response.getSoapBody().getFault();
Assert.assertEquals("Invalid fault code on fault", SoapVersion.SOAP_11.getClientOrSenderFaultName(),
fault.getFaultCode());
Assert.assertEquals("Invalid fault string on fault", "bla", fault.getFaultStringOrReason());
Assert.assertNull("Detail on fault", fault.getFaultDetail());
// SWS-226
result = resolver.resolveException(context, null, new IllegalArgumentException());
Assert.assertTrue("resolveException returns false", result);
Assert.assertTrue("Context has no response", context.hasResponse());
response = (SoapMessage) context.getResponse();
Assert.assertTrue("Response has no fault", response.getSoapBody().hasFault());
fault = (Soap11Fault) response.getSoapBody().getFault();
Assert.assertEquals("Invalid fault code on fault", SoapVersion.SOAP_11.getClientOrSenderFaultName(),
fault.getFaultCode());
Assert.assertEquals("Invalid fault string on fault", "java.lang.IllegalArgumentException",