### Question:
XMLToTemplateMapper implements XMLToObjectMapper { public Object getObjectFromOMNode(OMNode om, Properties properties) { if (!(om instanceof OMElement)) { throw new SynapseException("Configuration is not in proper format."); } OMElement elem = (OMElement) om; OMElement element = elem.getFirstChildWithName( new QName(SynapseConstants.SYNAPSE_NAMESPACE, "sequence")); if (element != null) { return MediatorFactoryFinder.getInstance().getMediator(elem, properties); } element = elem.getFirstChildWithName( new QName(SynapseConstants.SYNAPSE_NAMESPACE, "endpoint")); if (element != null) { TemplateFactory templateFactory = new TemplateFactory(); return templateFactory.createEndpointTemplate(elem, properties); } return null; }  Object getObjectFromOMNode(OMNode om, Properties properties);  }### Answer:
@Test public void testGetObjectFromOMNodeSequence() throws XMLStreamException { String input = "<template xmlns=\"http: " <sequence>\n" + " <log level=\"full\">\n" + " <property xmlns:ns2=\"http: "expression=\"$func:message\"></property>\n" + " </log>\n" + " </sequence>\n" + "</template>"; OMElement element = AXIOMUtil.stringToOM(input); TemplateMediator templateMediator = (TemplateMediator) mapper.getObjectFromOMNode(element, properties); Assert.assertEquals("name should be parsed into the element", NAME, templateMediator.getName()); }
@Test public void testGetObjectFromOMNodeEndpoint() throws XMLStreamException { String input = "<template xmlns=\"http: "<endpoint>\n" + " <address uri=\"http: " </endpoint>" + "</template>"; OMElement element = AXIOMUtil.stringToOM(input); Template template = (Template) mapper.getObjectFromOMNode(element, properties); Assert.assertEquals("name should be parsed into the template", NAME, template.getName()); }