### Question:
RMSoapOutInterceptor extends AbstractSoapInterceptor { public static void encodeFault(SoapMessage message, SequenceFault sf) { LOG.log(Level.FINE, "Encoding SequenceFault in SOAP header"); try { Message inmsg = message.getExchange().getInMessage(); RMProperties rmps = RMContextUtils.retrieveRMProperties(inmsg, false); AddressingProperties maps = RMContextUtils.retrieveMAPs(inmsg, false, false); ProtocolVariation protocol = ProtocolVariation.findVariant(rmps.getNamespaceURI(), maps.getNamespaceURI()); Header header = protocol.getCodec().buildHeaderFault(sf); List<Header> headers = message.getHeaders(); headers.add(header); } catch (JAXBException je) { LOG.log(Level.WARNING, "SOAP_HEADER_ENCODE_FAILURE_MSG", je); } } RMSoapOutInterceptor(); Set<QName> getUnderstoodHeaders(); void handleMessage(SoapMessage message); static void encode(SoapMessage message, RMProperties rmps); static void encodeFault(SoapMessage message, SequenceFault sf);  }### Answer:
@Test public void testEncodeFault() throws Exception { RMSoapOutInterceptor codec = new RMSoapOutInterceptor(); setUpOutbound(); SoapMessage message = setupOutboundFaultMessage(); codec.encode(message); verifyHeaders(message, new String[] {}); message = setupOutboundFaultMessage(); assertTrue(MessageUtils.isFault(message)); Exception ex = new RuntimeException(""); message.setContent(Exception.class, ex); codec.encode(message); verifyHeaders(message, new String[] {}); message = setupOutboundFaultMessage(); SoapFault f = new SoapFault("REASON", RM10Constants.UNKNOWN_SEQUENCE_FAULT_QNAME); message.setContent(Exception.class, f); codec.encode(message); verifyHeaders(message, new String[] {}); message = setupOutboundFaultMessage(); SequenceFault sf = new SequenceFault("REASON"); sf.setFaultCode(RM10Constants.UNKNOWN_SEQUENCE_FAULT_QNAME); Identifier sid = new Identifier(); sid.setValue("SID"); sf.setSender(true); f.initCause(sf); message.setContent(Exception.class, f); codec.encode(message); verifyHeaders(message, new String[] {RMConstants.SEQUENCE_FAULT_NAME}); }