Search in sources :

Example 1 with ComparableComparatorBug

use of spoon.test.generics.ComparableComparatorBug in project spoon by INRIA.

the class JavaReflectionTreeBuilderTest method testScannerGenericsInClass.

@Test
public void testScannerGenericsInClass() throws Exception {
    final CtType<ComparableComparatorBug> aType = new JavaReflectionTreeBuilder(createFactory()).scan(ComparableComparatorBug.class);
    assertNotNull(aType);
    // New type parameter declaration.
    assertEquals(1, aType.getFormalCtTypeParameters().size());
    CtTypeParameter ctTypeParameter = aType.getFormalCtTypeParameters().get(0);
    assertEquals("E extends java.lang.Comparable<? super E>", ctTypeParameter.toString());
    assertEquals(1, ctTypeParameter.getSuperclass().getActualTypeArguments().size());
    assertTrue(ctTypeParameter.getSuperclass().getActualTypeArguments().get(0) instanceof CtTypeParameterReference);
    assertEquals("? super E", ctTypeParameter.getSuperclass().getActualTypeArguments().get(0).toString());
}
Also used : CtTypeParameterReference(spoon.reflect.reference.CtTypeParameterReference) ComparableComparatorBug(spoon.test.generics.ComparableComparatorBug) CtTypeParameter(spoon.reflect.declaration.CtTypeParameter) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 CtTypeParameter (spoon.reflect.declaration.CtTypeParameter)1 CtTypeParameterReference (spoon.reflect.reference.CtTypeParameterReference)1 ComparableComparatorBug (spoon.test.generics.ComparableComparatorBug)1