Search in sources :

Example 1 with WildcardTypeImpl

use of org.evosuite.utils.generic.WildcardTypeImpl in project evosuite by EvoSuite.

the class TestGenericClass method testWildcardIntegerBoundaries.

@Test
public void testWildcardIntegerBoundaries() {
    WildcardType objectType = new WildcardTypeImpl(new Type[] { Integer.class }, new Type[] {});
    GenericClass integerClass = new GenericClass(Integer.class);
    GenericClass comparableClass = new GenericClass(Comparable.class);
    GenericClass dateClass = new GenericClass(java.util.Date.class);
    GenericClass sqlDateClass = new GenericClass(java.sql.Date.class);
    Assert.assertTrue(integerClass.satisfiesBoundaries(objectType));
    Assert.assertFalse(comparableClass.satisfiesBoundaries(objectType));
    Assert.assertFalse(dateClass.satisfiesBoundaries(objectType));
    Assert.assertFalse(sqlDateClass.satisfiesBoundaries(objectType));
}
Also used : WildcardType(java.lang.reflect.WildcardType) WildcardTypeImpl(org.evosuite.utils.generic.WildcardTypeImpl) GenericClass(org.evosuite.utils.generic.GenericClass) Test(org.junit.Test)

Example 2 with WildcardTypeImpl

use of org.evosuite.utils.generic.WildcardTypeImpl in project evosuite by EvoSuite.

the class TestGenericClass method testWildcardNumberBoundaries.

@Test
public void testWildcardNumberBoundaries() {
    WildcardType objectType = new WildcardTypeImpl(new Type[] { Number.class }, new Type[] {});
    GenericClass integerClass = new GenericClass(Integer.class);
    GenericClass comparableClass = new GenericClass(Comparable.class);
    GenericClass dateClass = new GenericClass(java.util.Date.class);
    GenericClass sqlDateClass = new GenericClass(java.sql.Date.class);
    Assert.assertTrue(integerClass.satisfiesBoundaries(objectType));
    Assert.assertFalse(comparableClass.satisfiesBoundaries(objectType));
    Assert.assertFalse(dateClass.satisfiesBoundaries(objectType));
    Assert.assertFalse(sqlDateClass.satisfiesBoundaries(objectType));
}
Also used : WildcardType(java.lang.reflect.WildcardType) WildcardTypeImpl(org.evosuite.utils.generic.WildcardTypeImpl) GenericClass(org.evosuite.utils.generic.GenericClass) Test(org.junit.Test)

Example 3 with WildcardTypeImpl

use of org.evosuite.utils.generic.WildcardTypeImpl in project evosuite by EvoSuite.

the class TestGenericClass method testWildcardInvalidBoundaries.

@Test
public void testWildcardInvalidBoundaries() {
    WildcardType objectType = new WildcardTypeImpl(new Type[] { Number.class }, new Type[] { java.util.Date.class });
    GenericClass integerClass = new GenericClass(Integer.class);
    GenericClass comparableClass = new GenericClass(Comparable.class);
    GenericClass dateClass = new GenericClass(java.util.Date.class);
    GenericClass sqlDateClass = new GenericClass(java.sql.Date.class);
    Assert.assertFalse(integerClass.satisfiesBoundaries(objectType));
    Assert.assertFalse(comparableClass.satisfiesBoundaries(objectType));
    Assert.assertFalse(dateClass.satisfiesBoundaries(objectType));
    Assert.assertFalse(sqlDateClass.satisfiesBoundaries(objectType));
}
Also used : WildcardType(java.lang.reflect.WildcardType) WildcardTypeImpl(org.evosuite.utils.generic.WildcardTypeImpl) GenericClass(org.evosuite.utils.generic.GenericClass) Test(org.junit.Test)

Example 4 with WildcardTypeImpl

use of org.evosuite.utils.generic.WildcardTypeImpl in project evosuite by EvoSuite.

the class TestGenericClass method testWildcardDateSuperBoundaries.

@Test
public void testWildcardDateSuperBoundaries() {
    WildcardType objectType = new WildcardTypeImpl(new Type[] { Object.class }, new Type[] { java.util.Date.class });
    GenericClass integerClass = new GenericClass(Integer.class);
    GenericClass comparableClass = new GenericClass(Comparable.class);
    GenericClass dateClass = new GenericClass(java.util.Date.class);
    GenericClass sqlDateClass = new GenericClass(java.sql.Date.class);
    Assert.assertFalse(integerClass.satisfiesBoundaries(objectType));
    Assert.assertFalse(comparableClass.satisfiesBoundaries(objectType));
    Assert.assertTrue(dateClass.satisfiesBoundaries(objectType));
    Assert.assertFalse(sqlDateClass.satisfiesBoundaries(objectType));
}
Also used : WildcardType(java.lang.reflect.WildcardType) WildcardTypeImpl(org.evosuite.utils.generic.WildcardTypeImpl) GenericClass(org.evosuite.utils.generic.GenericClass) Test(org.junit.Test)

Example 5 with WildcardTypeImpl

use of org.evosuite.utils.generic.WildcardTypeImpl in project evosuite by EvoSuite.

the class TestGenericClass method testWildcardComparableBoundaries.

@Test
public void testWildcardComparableBoundaries() {
    WildcardType objectType = new WildcardTypeImpl(new Type[] { Comparable.class }, new Type[] {});
    GenericClass integerClass = new GenericClass(Integer.class);
    GenericClass comparableClass = new GenericClass(Comparable.class);
    GenericClass dateClass = new GenericClass(java.util.Date.class);
    GenericClass sqlDateClass = new GenericClass(java.sql.Date.class);
    Assert.assertTrue(integerClass.satisfiesBoundaries(objectType));
    Assert.assertTrue(comparableClass.satisfiesBoundaries(objectType));
    Assert.assertTrue(dateClass.satisfiesBoundaries(objectType));
    Assert.assertTrue(sqlDateClass.satisfiesBoundaries(objectType));
}
Also used : WildcardType(java.lang.reflect.WildcardType) WildcardTypeImpl(org.evosuite.utils.generic.WildcardTypeImpl) GenericClass(org.evosuite.utils.generic.GenericClass) Test(org.junit.Test)

Aggregations

WildcardTypeImpl (org.evosuite.utils.generic.WildcardTypeImpl)12 Test (org.junit.Test)12 WildcardType (java.lang.reflect.WildcardType)10 GenericClass (org.evosuite.utils.generic.GenericClass)10 AbstractEnumInInnerClass (com.examples.with.different.packagename.AbstractEnumInInnerClass)2 EnumInInnerClass (com.examples.with.different.packagename.EnumInInnerClass)2 Method (java.lang.reflect.Method)2 Type (java.lang.reflect.Type)2 GenericConstructor (org.evosuite.utils.generic.GenericConstructor)2 GenericMethod (org.evosuite.utils.generic.GenericMethod)2