Search in sources :

Example 1 with Foo

use of spoon.test.enums.testclasses.Foo in project spoon by INRIA.

the class EnumsTest method testAnnotationsOnEnum.

@Test
public void testAnnotationsOnEnum() throws Exception {
    final Launcher launcher = new Launcher();
    launcher.run(new String[] { "-i", "./src/test/java/spoon/test/enums/testclasses", "-o", "./target/spooned" });
    final CtEnum<?> foo = (CtEnum) launcher.getFactory().Type().get(Foo.class);
    assertEquals(1, foo.getFields().size());
    assertEquals(1, foo.getFields().get(0).getAnnotations().size());
    assertEquals(Deprecated.class, AnnotationTest.getActualClassFromAnnotation(foo.getFields().get(0).getAnnotations().get(0)));
    assertEquals("public enum Foo {" + DefaultJavaPrettyPrinter.LINE_SEPARATOR + "    @java.lang.Deprecated" + DefaultJavaPrettyPrinter.LINE_SEPARATOR + "    Bar;}", foo.toString());
}
Also used : Foo(spoon.test.enums.testclasses.Foo) Launcher(spoon.Launcher) CtEnum(spoon.reflect.declaration.CtEnum) AnnotationTest(spoon.test.annotation.AnnotationTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Launcher (spoon.Launcher)1 CtEnum (spoon.reflect.declaration.CtEnum)1 AnnotationTest (spoon.test.annotation.AnnotationTest)1 Foo (spoon.test.enums.testclasses.Foo)1