Search in sources :

Example 1 with Pozole

use of spoon.test.reference.testclasses.Pozole in project spoon by INRIA.

the class VariableAccessTest method testDeclarationArray.

@Test
public void testDeclarationArray() throws Exception {
    final CtType<Pozole> aPozole = ModelUtils.buildClass(Pozole.class);
    final CtMethod<Object> m2 = aPozole.getMethod("m2");
    final CtArrayWrite<?> ctArrayWrite = m2.getElements(new TypeFilter<CtArrayWrite<?>>(CtArrayWrite.class)).get(0);
    final CtLocalVariable expected = m2.getElements(new TypeFilter<CtLocalVariable>(CtLocalVariable.class)).get(0);
    assertEquals(expected, ((CtVariableAccess) ctArrayWrite.getTarget()).getVariable().getDeclaration());
}
Also used : CtVariableAccess(spoon.reflect.code.CtVariableAccess) Pozole(spoon.test.reference.testclasses.Pozole) TypeFilter(spoon.reflect.visitor.filter.TypeFilter) CtLocalVariable(spoon.reflect.code.CtLocalVariable) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 CtLocalVariable (spoon.reflect.code.CtLocalVariable)1 CtVariableAccess (spoon.reflect.code.CtVariableAccess)1 TypeFilter (spoon.reflect.visitor.filter.TypeFilter)1 Pozole (spoon.test.reference.testclasses.Pozole)1