### Question:
DomUtil { public static List<Element> getElementsByTagNameCaseInsensitive(Document doc, final Set<String> lowerCaseNames) { final List<Element> result = Lists.newArrayList(); NodeIterator nodeIterator = ((DocumentTraversal) doc) .createNodeIterator(doc, NodeFilter.SHOW_ELEMENT, new NodeFilter() { public short acceptNode(Node n) { if (lowerCaseNames.contains(n.getNodeName().toLowerCase())) { return NodeFilter.FILTER_ACCEPT; } return NodeFilter.FILTER_REJECT; } }, false); for (Node n = nodeIterator.nextNode(); n != null ; n = nodeIterator.nextNode()) { result.add((Element)n); } return result; } private  DomUtil(); static Node getFirstNamedChildNode(Node root, String nodeName); static Node getLastNamedChildNode(Node root, String nodeName); static List<Element> getElementsByTagNameCaseInsensitive(Document doc,
      final Set<String> lowerCaseNames);  }### Answer:
@Test public void getElementsByTagNameCaseInsensitive() throws Exception { Element root = XmlUtil.parse(XML); Document doc = root.getOwnerDocument(); List<Element> elements = DomUtil.getElementsByTagNameCaseInsensitive(doc, ImmutableSet.of("element")); assertEquals("zero", elements.get(0).getTextContent()); assertEquals("one", elements.get(1).getTextContent()); assertEquals("two", elements.get(2).getTextContent()); }
@Test public void getElementsByTagNameCaseInsensitive() { Document doc = root.getOwnerDocument(); List<Element> elements = DomUtil.getElementsByTagNameCaseInsensitive(doc, ImmutableSet.of("element")); assertEquals("zero", elements.get(0).getTextContent()); assertEquals("one", elements.get(1).getTextContent()); assertEquals("two", elements.get(2).getTextContent()); }