Search in sources :

Example 1 with AbstractGuavaExample

use of com.examples.with.different.packagename.generic.AbstractGuavaExample in project evosuite by EvoSuite.

the class TestGenericClass method testGuavaExample.

@Test
public void testGuavaExample() {
    Type abstractGuavaExampleString = new TypeToken<AbstractGuavaExample<String>>() {
    }.getType();
    Type guavaExample5 = new TypeToken<GuavaExample5<String>>() {
    }.getType();
    GenericClass abstractClass = new GenericClass(abstractGuavaExampleString);
    GenericClass concreteClass = new GenericClass(guavaExample5);
    Assert.assertTrue(TypeUtils.isAssignable(concreteClass.getType(), abstractClass.getType()));
    Assert.assertTrue("Cannot assign " + concreteClass + " to " + abstractClass, abstractClass.isAssignableFrom(concreteClass));
    Assert.assertTrue(concreteClass.isAssignableTo(abstractClass));
}
Also used : WildcardType(java.lang.reflect.WildcardType) AnnotatedType(java.lang.reflect.AnnotatedType) ParameterizedType(java.lang.reflect.ParameterizedType) Type(java.lang.reflect.Type) GenericClass(org.evosuite.utils.generic.GenericClass) GuavaExample5(com.examples.with.different.packagename.generic.GuavaExample5) AbstractGuavaExample(com.examples.with.different.packagename.generic.AbstractGuavaExample) Test(org.junit.Test)

Aggregations

AbstractGuavaExample (com.examples.with.different.packagename.generic.AbstractGuavaExample)1 GuavaExample5 (com.examples.with.different.packagename.generic.GuavaExample5)1 AnnotatedType (java.lang.reflect.AnnotatedType)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 Type (java.lang.reflect.Type)1 WildcardType (java.lang.reflect.WildcardType)1 GenericClass (org.evosuite.utils.generic.GenericClass)1 Test (org.junit.Test)1