### Question:
SoapHeaderTransport { public void renderSoapHeader(final Map<String, String> context, final SOAPHeader soapHeader) { renderSoapHeader(SOAP_HEADER_MARSHALLER, context, soapHeader); } SoapHeaderTransport(); Map<String, String> parseSoapHeader(final Element soapHeader); Map<String, String> parseTpicHeader(final Element element); Map<String, String> parseTpicHeader(final Source source); void renderSoapHeader(final Map<String, String> context, final SOAPHeader soapHeader); void renderSoapHeader(final Map<String, String> context, final Result result);  }### Answer:
@Test public void renderTpicHeaderToSoapMessage() throws SOAPException { final Map<String, String> context = Collections.singletonMap("FOO", "BAR"); final SOAPHeader soapHeader = soapMessage.getSOAPHeader(); unit.renderSoapHeader(context, soapHeader); final Iterator soapHeaders = soapHeader.getChildElements(TraceeConstants.SOAP_HEADER_QNAME); final Element tpicHeader = (Element) soapHeaders.next(); assertThat(tpicHeader.getLocalName(), is(TraceeConstants.TPIC_HEADER)); assertThat(tpicHeader.getNamespaceURI(), is(TraceeConstants.SOAP_HEADER_NAMESPACE)); assertThat(tpicHeader.getFirstChild().getLocalName(), is("entry")); assertThat(tpicHeader.getFirstChild().getAttributes().getNamedItem("key").getNodeValue(), is("FOO")); assertThat(tpicHeader.getFirstChild().getFirstChild().getNodeValue(), is("BAR")); }
@Test public void renderTpicContextToResult() { final Map<String, String> context = new HashMap<>(); context.put("myKey", "myValue"); context.put("myKey2", "myValue2"); final StringWriter writer = new StringWriter(); unit.renderSoapHeader(context, new StreamResult(writer)); assertThat(writer.toString(), containsString("<entry key=\"myKey\">myValue</entry>")); assertThat(writer.toString(), containsString("<entry key=\"myKey2\">myValue2</entry>")); }