public void testIteratePointersArrayElementWithVariable() {
Map map = new HashMap();
map.put("foo", new String[] { "a", "b", "c" });
JXPathContext context = JXPathContext.newContext(map);
context.getVariables().declareVariable("x", new Integer(2));
Iterator it = context.iteratePointers("foo[$x]");
List actual = new ArrayList();
while (it.hasNext()) {
Pointer ptr = (Pointer) it.next();
actual.add(context.getValue(ptr.asPath()));
}
assertEquals("Iterating pointers <" + "foo" + ">", list("b"), actual);
}