JdbcConnectorServiceXmlParser extends AbstractXmlParser { @Override public void endElement(String uri, String localName, String qName) throws SAXException { if (!NAMESPACE.equals(uri)) { return; } ElementType.getTypeFromName(localName).endElement(stack); }  @Override String getNamespaceUri(); @Override void startElement(String uri, String localName, String qName, Attributes attributes); @Override void endElement(String uri, String localName, String qName); static final String NAMESPACE; }
@Test public void endElementRemovesJdbcServiceConfiguration() throws Exception { JdbcConnectorServiceXmlParser parser = new JdbcConnectorServiceXmlParser(); stack.push(regionCreation); RegionMapping regionMapping = mock(RegionMapping.class); stack.push(regionMapping); parser.setStack(stack); parser.endElement(NAMESPACE, JDBC_MAPPING.getTypeName(), null); assertThat(stack.pop()).isEqualTo(regionCreation); verifyNoMoreInteractions(regionMapping); }
@Test public void endElementRemovesWithWrongUriDoesNothing() throws Exception { JdbcConnectorServiceXmlParser parser = new JdbcConnectorServiceXmlParser(); stack.push(regionCreation); RegionMapping regionMapping = mock(RegionMapping.class); stack.push(regionMapping); parser.setStack(stack); parser.endElement("wrongNamespace", JDBC_MAPPING.getTypeName(), null); assertThat(stack.pop()).isEqualTo(regionMapping); verifyNoMoreInteractions(regionMapping); }