use of spoon.test.reference.testclasses.EnumValue in project spoon by INRIA.
the class TypeReferenceTest method testRecursiveTypeReferenceInGenericType.
@Test
public void testRecursiveTypeReferenceInGenericType() throws Exception {
final Launcher launcher = new Launcher();
launcher.addInputResource("./src/test/java/spoon/test/reference/testclasses/EnumValue.java");
launcher.setSourceOutputDirectory("./target/spoon-test");
launcher.run();
final CtClass<EnumValue> aClass = launcher.getFactory().Class().get(EnumValue.class);
final CtMethod<?> asEnum = aClass.getMethodsByName("asEnum").get(0);
// New type parameter declaration.
final CtTypeParameter typeParameter = asEnum.getFormalCtTypeParameters().get(0);
assertNotNull(typeParameter);
assertNotNull(typeParameter.getSuperclass());
final CtTypeReference<?> extendsGeneric = typeParameter.getSuperclass();
assertNotNull(extendsGeneric);
assertEquals(1, extendsGeneric.getActualTypeArguments().size());
final CtTypeReference circularRef = extendsGeneric.getActualTypeArguments().get(0);
assertNotNull(circularRef);
}
Aggregations