use of spoon.reflect.code.CtArrayRead in project spoon by INRIA.
the class AccessTest method testCanVisitArrayAccessAndSubClasses.
@Test
public void testCanVisitArrayAccessAndSubClasses() throws Exception {
final Factory factory = build(ArrayAccessSample.class);
final List<CtArrayRead<?>> arraysRead = Query.getElements(factory, new AbstractFilter<CtArrayRead<?>>(CtArrayRead.class) {
@Override
public boolean matches(CtArrayRead<?> element) {
return super.matches(element);
}
});
assertEquals(2, arraysRead.size());
final List<CtArrayWrite<?>> arraysWrite = Query.getElements(factory, new AbstractFilter<CtArrayWrite<?>>(CtArrayWrite.class) {
@Override
public boolean matches(CtArrayWrite<?> element) {
return super.matches(element);
}
});
assertEquals(1, arraysWrite.size());
final List<CtArrayAccess<?, CtExpression<?>>> arraysAccess = Query.getElements(factory, new AbstractFilter<CtArrayAccess<?, CtExpression<?>>>(CtArrayAccess.class) {
@Override
public boolean matches(CtArrayAccess<?, CtExpression<?>> element) {
return super.matches(element);
}
});
assertEquals(3, arraysAccess.size());
}
Aggregations