Search in sources :

Example 1 with Burritos

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

the class EnumsTest method testGetAllMethods.

@Test
public void testGetAllMethods() throws Exception {
    // contract: getAllMethods also returns the methods of Enum
    final Factory factory = build(Burritos.class);
    final CtType<Burritos> burritos = factory.Type().get(Burritos.class);
    CtMethod name = factory.Core().createMethod();
    // from Enum
    name.setSimpleName("name");
    name.setType(factory.Type().createReference(String.class));
    assertTrue(burritos.hasMethod(name));
    assertTrue(burritos.getAllMethods().contains(name));
}
Also used : Burritos(spoon.test.enums.testclasses.Burritos) Factory(spoon.reflect.factory.Factory) CtMethod(spoon.reflect.declaration.CtMethod) AnnotationTest(spoon.test.annotation.AnnotationTest) Test(org.junit.Test)

Example 2 with Burritos

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

the class EnumsTest method testEnumWithoutField.

@Test
public void testEnumWithoutField() throws Exception {
    final Factory factory = build(Burritos.class);
    final CtType<Burritos> burritos = factory.Type().get(Burritos.class);
    assertEquals(// 
    "public enum Burritos {" + DefaultJavaPrettyPrinter.LINE_SEPARATOR + "    ;" + DefaultJavaPrettyPrinter.LINE_SEPARATOR + // 
    DefaultJavaPrettyPrinter.LINE_SEPARATOR + "    public static void m() {" + // 
    DefaultJavaPrettyPrinter.LINE_SEPARATOR + "    }" + // 
    DefaultJavaPrettyPrinter.LINE_SEPARATOR + "}", burritos.toString());
}
Also used : Burritos(spoon.test.enums.testclasses.Burritos) Factory(spoon.reflect.factory.Factory) AnnotationTest(spoon.test.annotation.AnnotationTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Factory (spoon.reflect.factory.Factory)2 AnnotationTest (spoon.test.annotation.AnnotationTest)2 Burritos (spoon.test.enums.testclasses.Burritos)2 CtMethod (spoon.reflect.declaration.CtMethod)1