@Test
  public void testAddNewNodeNewNamed() throws Exception {
    final String xPath = "/cache:cache/cache:region[@name='r3']";
    NodeList nodes = XmlUtils.query(config, xPath, xPathContext);
    assertEquals(0, nodes.getLength());

    final Document changes = XmlUtils.createDocumentFromReader(new InputStreamReader(getClass()
        .getResourceAsStream("XmlUtilsAddNewNodeJUnitTest.testAddNewNodeNewNamed.xml")));
    nodes = XmlUtils.query(changes, xPath, xPathContext);
    assertEquals(1, nodes.getLength());
    Element element = (Element) nodes.item(0);
    assertEquals(CacheXml.GEODE_NAMESPACE, element.getNamespaceURI());

    final XmlEntity xmlEntity = XmlEntity.builder().withType("region").withAttribute("name", "r3")
        .withConfig(changes).build();
    XmlUtils.addNewNode(config, xmlEntity);

    nodes = XmlUtils.query(config, xPath, xPathContext);
    assertEquals(1, nodes.getLength());
    element = (Element) nodes.item(0);
    assertEquals(CacheXml.GEODE_NAMESPACE, element.getNamespaceURI());

    final List<Node> childNodes = getElementNodes(config.getFirstChild().getChildNodes());

    assertEquals("r2", childNodes.get(4).getAttributes().getNamedItem("name").getNodeValue());
    assertEquals("r3", childNodes.get(5).getAttributes().getNamedItem("name").getNodeValue());
    assertEquals("test:cache", childNodes.get(6).getNodeName());
  }
Tests {@link XmlUtils#addNewNode(Document, XmlEntity)} with {@link CacheXml} element with a
<code>name</code> attribute, <code>region</code>. It should be added after other
<code>region</code> elements.

@since GemFire 8.1
geode-core/src/integrationTest/java/org/apache/geode/management/internal/configuration/utils/XmlUtilsAddNewNodeJUnitTest.java