SimpleFaultMessageResolver implements FaultMessageResolver { @Override public void resolveFault(WebServiceMessage message) { if (message instanceof FaultAwareWebServiceMessage) { throw new WebServiceFaultException((FaultAwareWebServiceMessage) message); } else { throw new WebServiceFaultException("Message has unknown fault: " + message); } }  @Override void resolveFault(WebServiceMessage message);  }
@Test public void testResolveFault() throws Exception { FaultAwareWebServiceMessage messageMock = createMock(FaultAwareWebServiceMessage.class); String message = "message"; expect(messageMock.getFaultReason()).andReturn(message); replay(messageMock); try { resolver.resolveFault(messageMock); Assert.fail("WebServiceFaultExcpetion expected"); } catch (WebServiceFaultException ex) { Assert.assertEquals("Invalid exception message", message, ex.getMessage()); } verify(messageMock); }