use of com.tngtech.archunit.core.domain.JavaType in project ArchUnit by TNG.
the class ClassFileImporterGenericCodeUnitParameterTypesTest method test_imports_generic_code_unit_parameter_type_parameterized_with_type_variable.
@Test
@UseDataProvider
public void test_imports_generic_code_unit_parameter_type_parameterized_with_type_variable(JavaCodeUnit codeUnit) {
JavaType genericParameterType = codeUnit.getParameterTypes().get(0);
assertThatType(genericParameterType).as("generic parameter type").hasActualTypeArguments(typeVariable("OF_CLASS"));
}
use of com.tngtech.archunit.core.domain.JavaType in project ArchUnit by TNG.
the class ClassFileImporterGenericCodeUnitParameterTypesTest method test_imports_wildcards_of_generic_code_unit_parameter_type_bound_by_type_variables.
@Test
@UseDataProvider
public void test_imports_wildcards_of_generic_code_unit_parameter_type_bound_by_type_variables(JavaCodeUnit codeUnit) {
JavaType genericParameterType = codeUnit.getParameterTypes().get(0);
assertThatType(genericParameterType).as("generic parameter type").hasActualTypeArguments(parameterizedType(ClassParameterWithSingleTypeParameter.class).withWildcardTypeParameterWithUpperBound(typeVariable("FIRST").withUpperBounds(String.class)), parameterizedType(ClassParameterWithSingleTypeParameter.class).withWildcardTypeParameterWithLowerBound(typeVariable("SECOND").withUpperBounds(Serializable.class)));
}
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_parameterized_array_bounds.
@Test
@UseDataProvider
public void test_imports_generic_code_unit_parameter_type_with_parameterized_array_bounds(JavaCodeUnit codeUnit) {
JavaType genericParameterType = codeUnit.getParameterTypes().get(0);
assertThatType(genericParameterType).hasActualTypeArguments(genericArray(parameterizedTypeArrayName(List.class, String.class, 1)).withComponentType(parameterizedType(List.class).withTypeArguments(String.class)), genericArray(parameterizedTypeArrayName(List.class, String[].class, 2)).withComponentType(genericArray(parameterizedTypeArrayName(List.class, String[].class, 1)).withComponentType(parameterizedType(List.class).withTypeArguments(String[].class))), genericArray(parameterizedTypeArrayName(List.class, String[][].class, 3)).withComponentType(genericArray(parameterizedTypeArrayName(List.class, String[][].class, 2)).withComponentType(genericArray(parameterizedTypeArrayName(List.class, String[][].class, 1)).withComponentType(parameterizedType(List.class).withTypeArguments(String[][].class)))));
}
use of com.tngtech.archunit.core.domain.JavaType in project ArchUnit by TNG.
the class ClassFileImporterGenericCodeUnitParameterTypesTest method test_considers_hierarchy_of_methods_and_classes_for_type_parameter_context.
@Test
@UseDataProvider
public void test_considers_hierarchy_of_methods_and_classes_for_type_parameter_context(JavaCodeUnit codeUnit) {
JavaType genericParameterType = codeUnit.getParameterTypes().get(0);
assertThatType(genericParameterType).as("generic parameter type").matches(typeVariable("T4").withUpperBounds(typeVariable("T3").withUpperBounds(typeVariable("T2").withUpperBounds(typeVariable("T1").withUpperBounds(String.class)))));
}
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_actual_type_arguments_parameterized_with_bounded_wildcards.
@Test
@UseDataProvider
public void test_imports_generic_code_unit_parameter_type_with_actual_type_arguments_parameterized_with_bounded_wildcards(JavaCodeUnit codeUnit) {
JavaType genericParameterType = codeUnit.getParameterTypes().get(0);
assertThatType(genericParameterType).as("generic parameter type").hasActualTypeArguments(parameterizedType(ClassParameterWithSingleTypeParameter.class).withWildcardTypeParameterWithUpperBound(String.class), parameterizedType(ClassParameterWithSingleTypeParameter.class).withWildcardTypeParameterWithLowerBound(File.class));
}
Aggregations