SoapFormattingMessageProcessor extends XmlFormattingMessageProcessor { @Override public void processMessage(Message message, TestContext context) { if (message instanceof SoapFault) { List<String> faultDetailsFormat = new ArrayList<>(); for (String faultDetail : ((SoapFault) message).getFaultDetails()) { faultDetailsFormat.add(XMLUtils.prettyPrint(faultDetail)); } if (faultDetailsFormat.size() > 0) { ((SoapFault) message).faultDetails(faultDetailsFormat); } } super.processMessage(message, context); }  @Override void processMessage(Message message, TestContext context);  }
@Test public void testProcessMessage() throws Exception { SoapMessage message = new SoapMessage("<root>" + "<element attribute='attribute-value'>" + "<sub-element>text-value</sub-element>" + "</element>" + "</root>"); message.setType(MessageType.XML.name()); messageProcessor.process(message, context); Assert.assertTrue(message.getPayload(String.class).contains(System.lineSeparator())); }