SoapResponseHeaderInterceptor extends AbstractSoapInterceptor { @Override public void handleMessage(SoapMessage message) throws Fault { SoapMessage requestMessage = (SoapMessage) message.getExchange().getInMessage(); List<Header> headers = requestMessage.getHeaders(); message.put(Header.HEADER_LIST, headers); } SoapResponseHeaderInterceptor(); @Override void handleMessage(SoapMessage message);  }
@Test public void whenSoapFaultHasNoCauseThenFaultStatusAndCodeRemainUnchanged() { SoapMessage requestMessage = mock(SoapMessage.class); Exchange exchange = mock(Exchange.class); doReturn(exchange).when(responseMessage).getExchange(); doReturn(requestMessage).when(exchange).getInMessage(); doReturn(requestSoapHeaders).when(requestMessage).getHeaders(); soapResponseHeaderInterceptor.handleMessage(responseMessage); verify(responseMessage).put(Header.HEADER_LIST, requestSoapHeaders); }