resolver.setExceptionMappings(mappings);
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_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());
Soap12Fault fault = (Soap12Fault) response.getSoapBody().getFault();
Assert.assertEquals("Invalid fault code on fault", SoapVersion.SOAP_12.getClientOrSenderFaultName(),
fault.getFaultCode());
Assert.assertEquals("Invalid fault string on fault", "Sender error", fault.getFaultReasonText(Locale.ENGLISH));