use of com.tngtech.archunit.core.domain.JavaType in project ArchUnit by TNG.
the class ClassFileImporterGenericSuperclassTest method imports_non_generic_superclass.
@Test
public void imports_non_generic_superclass() {
class BaseClass {
}
class Child extends BaseClass {
}
JavaType genericSuperclass = importClassWithOnlyGenericTypeResolution(Child.class).getSuperclass().get();
assertThatType(genericSuperclass).as("generic superclass").matches(BaseClass.class);
}
use of com.tngtech.archunit.core.domain.JavaType in project ArchUnit by TNG.
the class ClassFileImporterGenericSuperclassTest method imports_generic_superclass_parameterized_with_type_variable.
@Test
public void imports_generic_superclass_parameterized_with_type_variable() {
@SuppressWarnings("unused")
class BaseClass<SUPER> {
}
class Child<SUB> extends BaseClass<SUB> {
}
JavaType genericSuperclass = importClassWithOnlyGenericTypeResolution(Child.class).getSuperclass().get();
assertThatType(genericSuperclass).as("generic superclass").hasActualTypeArguments(typeVariable("SUB"));
}
use of com.tngtech.archunit.core.domain.JavaType in project ArchUnit by TNG.
the class ClassFileImporterGenericSuperclassTest method imports_generic_superclass_with_single_actual_type_argument_parameterized_with_unbound_wildcard.
@Test
public void imports_generic_superclass_with_single_actual_type_argument_parameterized_with_unbound_wildcard() {
@SuppressWarnings("unused")
class BaseClass<T> {
}
class Child extends BaseClass<ClassParameterWithSingleTypeParameter<?>> {
}
JavaType genericSuperclass = importClassWithOnlyGenericTypeResolution(Child.class).getSuperclass().get();
assertThatType(genericSuperclass).as("generic superclass").hasActualTypeArguments(parameterizedType(ClassParameterWithSingleTypeParameter.class).withWildcardTypeParameter());
}
use of com.tngtech.archunit.core.domain.JavaType in project ArchUnit by TNG.
the class ClassFileImporterGenericCodeUnitParameterTypesTest method test_imports_generic_code_unit_parameter_type_with_single_unbound_wildcard.
@Test
@UseDataProvider
public void test_imports_generic_code_unit_parameter_type_with_single_unbound_wildcard(JavaCodeUnit codeUnit) {
JavaType genericParameterType = codeUnit.getParameterTypes().get(0);
assertThatType(genericParameterType).as("generic parameter type").hasActualTypeArguments(wildcardType());
}
use of com.tngtech.archunit.core.domain.JavaType in project ArchUnit by TNG.
the class ClassFileImporterGenericCodeUnitParameterTypesTest method test_imports_generic_code_unit_parameter_type_with_array_type_argument.
@Test
@UseDataProvider
public void test_imports_generic_code_unit_parameter_type_with_array_type_argument(JavaCodeUnit codeUnit) {
JavaType genericMethodParameterType = codeUnit.getParameterTypes().get(0);
assertThatType(genericMethodParameterType).as("generic parameter type").hasErasure(ClassParameterWithSingleTypeParameter.class).hasActualTypeArguments(String[].class);
}
Aggregations