* Property references can access array members
*/
public void testArrayAccessors() throws Exception {
Expression e = buildExpression("im[0]");
assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
PropertyReference pr = (PropertyReference) e;
assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot());
pr = pr.getStem();
assertEquals("Unable to access array member via PropertyReference", "0", pr.getRoot());
assertNull("Stemming end of PropertyReference should return null", pr.getStem());
e = buildExpression("im.an[3151345]");
assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
pr = (PropertyReference) e;
assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot());
pr = pr.getStem();
assertEquals("Unexpected root of PropertyReference after stemming", "an", pr.getRoot());
pr = pr.getStem();
assertEquals("Unable to access array member via PropertyReference after stemming", "3151345", pr.getRoot());
assertNull("Stemming end of PropertyReference should return null", pr.getStem());
e = buildExpression("im.an[3151345].array");
assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
pr = (PropertyReference) e;
assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot());
pr = pr.getStem();
assertEquals("Unexpected root of PropertyReference after stemming", "an", pr.getRoot());
pr = pr.getStem();
assertEquals("Unable to access array member via PropertyReference after stemming", "3151345", pr.getRoot());
pr = pr.getStem();
assertEquals("Unexpected root of PropertyReference after stemming and accessing array", "array", pr.getRoot());
assertNull("Stemming end of PropertyReference should return null", pr.getStem());
e = buildExpression("multi[1][364]");
assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
pr = (PropertyReference) e;
assertEquals("Unexpected root of PropertyReference", "multi", pr.getRoot());
pr = pr.getStem();
assertEquals("Unable to access array member via PropertyReference", "1", pr.getRoot());
pr = pr.getStem();
assertEquals("Unable to access second array member via PropertyReference", "364", pr.getRoot());
assertNull("Stemming end of PropertyReference should return null", pr.getStem());
}