SimpleSoapExceptionResolver extends AbstractEndpointExceptionResolver { @Override protected final boolean resolveExceptionInternal(MessageContext messageContext, Object endpoint, Exception ex) { Assert.isInstanceOf(SoapMessage.class, messageContext.getResponse(), "SimpleSoapExceptionResolver requires a SoapMessage"); SoapMessage response = (SoapMessage) messageContext.getResponse(); String faultString = StringUtils.hasLength(ex.getMessage()) ? ex.getMessage() : ex.toString(); SoapBody body = response.getSoapBody(); SoapFault fault = body.addServerOrReceiverFault(faultString, getLocale()); customizeFault(messageContext, endpoint, ex, fault); return true; }  Locale getLocale(); void setLocale(Locale locale);  }
@Test public void testResolveExceptionInternal() throws Exception { Exception exception = new Exception("message"); expect(factoryMock.createWebServiceMessage()).andReturn(messageMock); expect(messageMock.getSoapBody()).andReturn(bodyMock); expect(bodyMock.addServerOrReceiverFault(exception.getMessage(), Locale.ENGLISH)).andReturn(null); replay(factoryMock, messageMock, bodyMock); boolean result = exceptionResolver.resolveExceptionInternal(messageContext, null, exception); Assert.assertTrue("Invalid result", result); verify(factoryMock, messageMock, bodyMock); }