@Test
public void testSteps() throws Exception {
FeatureType complexType = ComplexTestData
.createExample01MultiValuedComplexProperty(new UniqueNameFeatureTypeFactoryImpl());
Name name = complexType.getName();
AttributeDescriptor descriptor = new AttributeDescriptorImpl(complexType, name, 0,
Integer.MAX_VALUE, true, null);
NamespaceSupport namespaces = new NamespaceSupport();
namespaces.declarePrefix("wq", name.getNamespaceURI());
try {
XPathUtil.steps(descriptor, null, namespaces);
fail("passed null");
} catch (NullPointerException e) {
}
List expected;
String xpath;
xpath = "/";
assertEquals(1, XPathUtil.steps(descriptor, xpath, namespaces).size());
XPathUtil.Step step = (XPathUtil.Step) XPathUtil.steps(descriptor, xpath, namespaces).get(0);
QName rootQName = new QName(name.getNamespaceURI(), name.getLocalPart());
assertEquals(rootQName, step.getName());
expected = Collections.singletonList(new XPathUtil.Step(rootQName, 1));
xpath = "wq_plus";
assertEquals(expected, XPathUtil.steps(descriptor, xpath, namespaces));