client.getEndpointConfiguration().setErrorHandlingStrategy(ErrorHandlingStrategy.THROWS_EXCEPTION);
Message requestMessage = new DefaultMessage("<TestRequest><Message>Hello World!</Message></TestRequest>");
org.springframework.ws.soap.SoapMessage soapFaultMessage = EasyMock.createMock(org.springframework.ws.soap.SoapMessage.class);
SoapBody soapBody = EasyMock.createMock(SoapBody.class);
SoapFault soapFault = EasyMock.createMock(SoapFault.class);
reset(webServiceTemplate, soapFaultMessage, soapBody, soapFault);
webServiceTemplate.setDefaultUri("http://localhost:8080/request");
expectLastCall().once();
webServiceTemplate.setFaultMessageResolver(anyObject(FaultMessageResolver.class));
expectLastCall().once();
expect(soapFaultMessage.getSoapBody()).andReturn(soapBody).anyTimes();
expect(soapFaultMessage.getFaultReason()).andReturn("Internal server error").anyTimes();
expect(soapBody.getFault()).andReturn(soapFault).once();
replay(soapFaultMessage, soapBody, soapFault);
expect(webServiceTemplate.sendAndReceive(eq("http://localhost:8080/request"), (WebServiceMessageCallback)anyObject(),
(WebServiceMessageCallback)anyObject())).andThrow(new SoapFaultClientException(soapFaultMessage)).once();