XPathUtil { public static StepList rootElementSteps(final AttributeDescriptor rootElement, final NamespaceSupport namespaces) throws IllegalArgumentException { if (rootElement == null) { throw new NullPointerException("root"); } StepList steps = new StepList(); QName qName = Types.toQName(rootElement.getName(), namespaces); steps.add(new Step(qName, 1, false, false)); return steps; }  static StepList rootElementSteps(final AttributeDescriptor rootElement,
            final NamespaceSupport namespaces); static StepList steps(final AttributeDescriptor root, final String xpathExpression,
            final NamespaceSupport namespaces); static boolean equals(Name targetNodeName, StepList targetXPath);  }
@Test public void testRootElementSteps() { NamespaceSupport namespaces = new NamespaceSupport(); try { XPathUtil.rootElementSteps(null, namespaces); fail("passed null"); } catch (NullPointerException e) { } FeatureType complexType = ComplexTestData .createExample05NoNamespaceURI(new UniqueNameFeatureTypeFactoryImpl()); Name name = complexType.getName(); AttributeDescriptor descriptor = new AttributeDescriptorImpl(complexType, name, 0, Integer.MAX_VALUE, true, null); try { XPathUtil.rootElementSteps(descriptor, namespaces); } catch (NullPointerException e) { fail("failed null"); } assertEquals(1, XPathUtil.rootElementSteps(descriptor, namespaces).size()); XPathUtil.Step step = XPathUtil.rootElementSteps(descriptor, namespaces).get(0); QName rootQName = new QName(name.getNamespaceURI(), name.getLocalPart(), ""); assertEquals(rootQName, step.getName()); complexType = ComplexTestData .createExample01MultiValuedComplexProperty(new UniqueNameFeatureTypeFactoryImpl()); name = complexType.getName(); descriptor = new AttributeDescriptorImpl(complexType, name, 0, Integer.MAX_VALUE, true, null); String prefix = "wq"; namespaces.declarePrefix(prefix, name.getNamespaceURI()); try { XPathUtil.rootElementSteps(descriptor, namespaces); } catch (NullPointerException e) { fail("failed null"); } assertEquals(1, XPathUtil.rootElementSteps(descriptor, namespaces).size()); step = XPathUtil.rootElementSteps(descriptor, namespaces).get(0); rootQName = new QName(name.getNamespaceURI(), name.getLocalPart(), prefix); assertEquals(rootQName, step.getName()); }