Search in sources :

Example 1 with Foo2

use of spoon.test.constructorcallnewclass.testclasses.Foo2 in project spoon by INRIA.

the class NewClassTest method testMoreThan9NewClass.

@Test
public void testMoreThan9NewClass() throws Exception {
    final Factory build = build(Foo2.class);
    final CtClass<?> foo = (CtClass<?>) build.Type().get(Foo2.class);
    List<CtNewClass<?>> elements = foo.getElements(new AbstractFilter<CtNewClass<?>>(CtNewClass.class) {

        @Override
        public boolean matches(CtNewClass<?> element) {
            return true;
        }
    });
    assertEquals(13, elements.size());
    assertEquals(Foo2.class.getCanonicalName() + "$12", elements.get(11).getAnonymousClass().getQualifiedName());
    assertEquals(Foo2.class.getCanonicalName() + "$12$1", elements.get(12).getAnonymousClass().getQualifiedName());
}
Also used : CtClass(spoon.reflect.declaration.CtClass) CtNewClass(spoon.reflect.code.CtNewClass) Factory(spoon.reflect.factory.Factory) Foo2(spoon.test.constructorcallnewclass.testclasses.Foo2) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 CtNewClass (spoon.reflect.code.CtNewClass)1 CtClass (spoon.reflect.declaration.CtClass)1 Factory (spoon.reflect.factory.Factory)1 Foo2 (spoon.test.constructorcallnewclass.testclasses.Foo2)1