use of com.tngtech.archunit.core.domain.JavaWildcardType in project ArchUnit by TNG.
the class ClassFileImporterAutomaticResolutionTest method test_automatically_resolves_parameterized_generic_type_bounds.
@Test
@UseDataProvider
public void test_automatically_resolves_parameterized_generic_type_bounds(JavaParameterizedType actual1stLevel, Class<?> expected1stLevel, Class<?> expected2ndLevel, Class<?> expected3rdLevel) {
assertThat(actual1stLevel.toErasure()).isFullyImported(true);
assertThatType(actual1stLevel.toErasure()).matches(expected1stLevel);
JavaParameterizedType actual2ndLevel = (JavaParameterizedType) getOnlyElement(((JavaWildcardType) getOnlyElement(actual1stLevel.getActualTypeArguments())).getUpperBounds());
assertThat(actual2ndLevel.toErasure()).isFullyImported(true);
assertThatType(actual2ndLevel.toErasure()).matches(expected2ndLevel);
JavaClass actual3rdLevel = (JavaClass) getOnlyElement(((JavaWildcardType) actual2ndLevel.getActualTypeArguments().get(1)).getLowerBounds());
assertThat(actual3rdLevel.toErasure()).isFullyImported(true);
assertThatType(actual3rdLevel.toErasure()).matches(expected3rdLevel);
}
use of com.tngtech.archunit.core.domain.JavaWildcardType in project ArchUnit by TNG.
the class ClassFileImporterAutomaticResolutionTest method getFirstTypeArgumentUpperBound.
private static JavaType getFirstTypeArgumentUpperBound(JavaType type) {
JavaParameterizedType parameterizedType = (JavaParameterizedType) type;
JavaWildcardType firstTypeArgument = (JavaWildcardType) parameterizedType.getActualTypeArguments().get(0);
return firstTypeArgument.getUpperBounds().get(0);
}
Aggregations