### Question:
AbstractXmlCollectionHandler implements XmlCollectionHandler { protected String parseString(final String reference, final String unformattedString, final OnmsNode node, final String ipAddress) throws IllegalArgumentException { if (unformattedString == null) return null; String formattedString = unformattedString.replaceAll("[{](?i)(ipAddr|ipAddress)[}]", ipAddress); formattedString = formattedString.replaceAll("[{](?i)nodeId[}]", node.getNodeId()); if (node.getLabel() != null) formattedString = formattedString.replaceAll("[{](?i)nodeLabel[}]", node.getLabel()); if (node.getForeignId() != null) formattedString = formattedString.replaceAll("[{](?i)foreignId[}]", node.getForeignId()); if (node.getForeignSource() != null) formattedString = formattedString.replaceAll("[{](?i)foreignSource[}]", node.getForeignSource()); if (node.getAssetRecord() != null) { BeanWrapper wrapper = new BeanWrapperImpl(node.getAssetRecord()); for (PropertyDescriptor p : wrapper.getPropertyDescriptors()) { Object obj = wrapper.getPropertyValue(p.getName()); if (obj != null) formattedString = formattedString.replaceAll("[{](?i)" + p.getName() + "[}]", obj.toString()); } } if (formattedString.matches(".*[{].+[}].*")) throw new IllegalArgumentException("The " + reference + " " + formattedString + " contains unknown placeholders."); return formattedString; }  void setServiceName(String serviceName); void setRrdRepository(RrdRepository rrdRepository); String getServiceName(); RrdRepository getRrdRepository(); NodeDao getNodeDao(); void setNodeDao(NodeDao nodeDao);  }### Answer:
@Test public void testParseString() throws Exception { AbstractXmlCollectionHandler handler = new AbstractXmlCollectionHandler() { @Override public XmlCollectionSet collect(CollectionAgent agent, XmlDataCollection collection, Map<String, Object> parameters) throws CollectionException { return null; } @Override protected void processXmlResource( XmlCollectionResource collectionResource, AttributeGroupType attribGroupType) { } }; OnmsNode node = new OnmsNode(); node.setId(1); node.setLabel("mynode.local"); OnmsAssetRecord asset = new OnmsAssetRecord(); asset.setSerialNumber("1001"); node.setAssetRecord(asset); String url = handler.parseString("URL", "http: Assert.assertEquals("http: String multiline = "<data>\n <source label='{nodeLabel}'/>\n</data>"; String xml = handler.parseString("Content", multiline, node, "127.0.0.1"); Assert.assertEquals("<data>\n <source label='mynode.local'/>\n</data>", xml); }