Search in sources :

Example 1 with GuavaExample4

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

the class TestGenericAccessibleObject method testGenericMethodFromReturnValueTypeVariable2.

@Test
public void testGenericMethodFromReturnValueTypeVariable2() throws SecurityException, NoSuchMethodException, ConstructionFailedException {
    Class<?> targetClass = com.examples.with.different.packagename.generic.GuavaExample4.class;
    Method targetMethod = targetClass.getMethod("create", new Class<?>[] {});
    GenericMethod genericMethod = new GenericMethod(targetMethod, targetClass);
    GenericClass iterableIntegerClass = new GenericClass(new TypeToken<com.examples.with.different.packagename.generic.GuavaExample4<java.lang.Iterable<Integer>>>() {
    }.getType());
    GenericMethod instantiatedMethod = genericMethod.getGenericInstantiationFromReturnValue(iterableIntegerClass);
    System.out.println(instantiatedMethod.getGeneratedClass().toString());
    Assert.assertEquals(instantiatedMethod.getGeneratedClass().getRawClass(), GuavaExample4.class);
}
Also used : GuavaExample4(com.examples.with.different.packagename.generic.GuavaExample4) GenericMethod(org.evosuite.utils.generic.GenericMethod) Method(java.lang.reflect.Method) GenericMethod(org.evosuite.utils.generic.GenericMethod) GenericClass(org.evosuite.utils.generic.GenericClass) TypeToken(com.googlecode.gentyref.TypeToken) Test(org.junit.Test)

Aggregations

GuavaExample4 (com.examples.with.different.packagename.generic.GuavaExample4)1 TypeToken (com.googlecode.gentyref.TypeToken)1 Method (java.lang.reflect.Method)1 GenericClass (org.evosuite.utils.generic.GenericClass)1 GenericMethod (org.evosuite.utils.generic.GenericMethod)1 Test (org.junit.Test)1