MatcherPosition implements Position { @Override public String createPlaceholder( PayloadPosition payloadPosition ) { String pre = removePlaceholder( xmlWithPlaceholder.substring( 0, finding.start ) ); String post = removePlaceholder( xmlWithPlaceholder.substring( finding.end, xmlWithPlaceholder.length() ) ); return pre + finding.placeholder + post; } MatcherPosition( String xmlWithPlaceholder, Finding finding ); @Override String createPlaceholder( PayloadPosition payloadPosition ); @Override int hashCode(); @Override boolean equals( Object obj ); @Override String toString();  }
@Test public void createContentTest() { Finding finding = new Finding(); finding.start = 18; finding.end = 33; finding.placeholder = "$$PAYLOADATTR$$"; MatcherPosition matcherPosition = new MatcherPosition( xmlWithPlaceholder, finding ); assertThat( matcherPosition.createPlaceholder( PayloadPosition.ATTRIBUTE ), is( "<soapenv:Envelope $$PAYLOADATTR$$>" + " <soapenv:Header ></soapenv:Header>" + " <soapenv:Body >" + " <cxf:celsiusToFarenheit>" + " <arg0>1</arg0>" + " </cxf:celsiusToFarenheit>" + " </soapenv:Body>" + "</soapenv:Envelope>" ) ); }