@Test
public void flattenArrayAccess() {

    List<Node> actual = flattenScope(MockTypeResolver.INSTANCE, expr("$p.getChildrenA()[0]"));
    NameExpr name = new NameExpr("$p");
    final MethodCallExpr mc = new MethodCallExpr(name, "getChildrenA", nodeList());
    mc.setTypeArguments(NodeList.nodeList());
    List<Node> expected = asList(name, mc, new ArrayAccessExpr(mc, new IntegerLiteralExpr(0)));
    compareArrays(actual, expected);
}