SoapMessageColorizer implements MessageColorizer { @Override public Collection<MessageFragmentStyle> colorize(String message) { initStyles(); List<MessageFragmentStyle> list = new ArrayList<>(); SortedSet<SubText> findSoaps = soapFinder.findSoaps(message); for (SubText subText : findSoaps) { int fragmentStart = subText.getStart(); colorizeFragment(message, fragmentStart, list); } return list; } SoapMessageColorizer(Theme theme); @Override boolean colorizingNeeded(String message); @Override Collection<MessageFragmentStyle> colorize(String message); @Override String getName(); @Override String getDescription(); @Override String getPluginableId(); @Override int getApiVersion();  }
@Test public void testColorize() throws Exception { String message = loadResources("soap/soap.1.request.xml"); Collection<MessageFragmentStyle> colorize = colorizer.colorize(message); HashMap<Integer, MessageFragmentStyle> map = new HashMap<>(colorize.size()); for (MessageFragmentStyle messageFragmentStyle : colorize) { map.put(Integer.valueOf(messageFragmentStyle.getOffset()), messageFragmentStyle); } AssertJUnit.assertEquals(map.get(Integer.valueOf(88)).getStyle(), colorizer.styleOperator); AssertJUnit.assertEquals(map.get(Integer.valueOf(89)).getStyle(), colorizer.styleElementName); AssertJUnit.assertEquals(map.get(Integer.valueOf(121)).getStyle(), colorizer.styleAttributeName); AssertJUnit.assertEquals(map.get(Integer.valueOf(129)).getStyle(), colorizer.styleAttributeValue); AssertJUnit.assertEquals(map.get(Integer.valueOf(180)).getStyle(), colorizer.styleContent); }