use of org.evosuite.utils.generic.GenericClass in project evosuite by EvoSuite.
the class TestGenericClass method test3.
@Test
public void test3() {
Type listOfInteger = new TypeToken<List<Integer>>() {
}.getType();
Type listOfSerializable = new TypeToken<List<Serializable>>() {
}.getType();
GenericClass listOfIntegerClass = new GenericClass(listOfInteger);
GenericClass listOfSerializableClass = new GenericClass(listOfSerializable);
Assert.assertFalse(listOfIntegerClass.isAssignableFrom(listOfSerializableClass));
Assert.assertFalse(listOfSerializableClass.isAssignableFrom(listOfIntegerClass));
Assert.assertTrue(listOfIntegerClass.isAssignableFrom(listOfIntegerClass));
Assert.assertTrue(listOfSerializableClass.isAssignableFrom(listOfSerializableClass));
}
use of org.evosuite.utils.generic.GenericClass in project evosuite by EvoSuite.
the class TestGenericClass method testAssignableClass.
@Test
public void testAssignableClass() {
GenericClass clazzTypeVar = new GenericClass(Class.class);
GenericClass clazzWildcard = clazzTypeVar.getWithWildcardTypes();
ParameterizedType type = new ParameterizedTypeImpl(Class.class, new Type[] { Integer.class }, null);
GenericClass clazzConcrete = new GenericClass(type);
Assert.assertFalse(clazzWildcard.isAssignableTo(clazzConcrete));
Assert.assertFalse(clazzWildcard.isAssignableTo(clazzTypeVar));
Assert.assertTrue(clazzWildcard.isAssignableTo(clazzWildcard));
Assert.assertFalse(clazzTypeVar.isAssignableTo(clazzConcrete));
Assert.assertTrue(clazzTypeVar.isAssignableTo(clazzTypeVar));
Assert.assertTrue(clazzTypeVar.isAssignableTo(clazzWildcard));
Assert.assertTrue(clazzConcrete.isAssignableTo(clazzConcrete));
Assert.assertFalse(clazzConcrete.isAssignableTo(clazzTypeVar));
Assert.assertTrue(clazzConcrete.isAssignableTo(clazzWildcard));
}
use of org.evosuite.utils.generic.GenericClass in project evosuite by EvoSuite.
the class TestGenericClass method testPrimitiveWrapper.
@Test
public void testPrimitiveWrapper() {
GenericClass integerClass = new GenericClass(Integer.class);
GenericClass intClass = new GenericClass(int.class);
Assert.assertTrue(integerClass.canBeInstantiatedTo(intClass));
Assert.assertFalse(intClass.canBeInstantiatedTo(integerClass));
}
use of org.evosuite.utils.generic.GenericClass in project evosuite by EvoSuite.
the class TestGenericClass method testGenericSuperclassConcreteList.
@Test
public void testGenericSuperclassConcreteList() {
GenericClass listOfInteger = new GenericClass(new TypeToken<List<Integer>>() {
}.getType());
GenericClass linkedlistOfInteger = new GenericClass(new TypeToken<LinkedList<Integer>>() {
}.getType());
Assert.assertTrue(linkedlistOfInteger.canBeInstantiatedTo(listOfInteger));
Assert.assertFalse(listOfInteger.canBeInstantiatedTo(linkedlistOfInteger));
}
use of org.evosuite.utils.generic.GenericClass in project evosuite by EvoSuite.
the class TestGenericClass method test1.
@Test
public void test1() {
Type listOfString = new TypeToken<List<String>>() {
}.getType();
Type listOfInteger = new TypeToken<List<Integer>>() {
}.getType();
GenericClass listOfStringClass = new GenericClass(listOfString);
GenericClass listOfIntegerClass = new GenericClass(listOfInteger);
Assert.assertFalse(listOfStringClass.isAssignableFrom(listOfIntegerClass));
Assert.assertFalse(listOfStringClass.isAssignableTo(listOfIntegerClass));
}
Aggregations