Prefer explicitly declared generic parameter over Iterable in TypeDiscoverer.getComponentType().
Related ticket: #2312.
This commit is contained in:
@@ -31,6 +31,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.beans.factory.annotation.Autowire;
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.data.geo.GeoResults;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
@@ -326,6 +327,14 @@ public class TypeDiscovererUnitTests {
|
||||
assertThat(map.getMapValueType().getType()).isEqualTo(String.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void detectsComponentTypeOfTypedClass() {
|
||||
|
||||
TypeInformation<?> property = TypeInformation.of(GeoResultsWrapper.class).getProperty("results");
|
||||
|
||||
assertThat(property.getComponentType().getType()).isEqualTo(Leaf.class);
|
||||
}
|
||||
|
||||
class Person {
|
||||
|
||||
Addresses addresses;
|
||||
@@ -415,4 +424,8 @@ public class TypeDiscovererUnitTests {
|
||||
class EnumMapWrapper {
|
||||
EnumMap<Autowire, String> map;
|
||||
}
|
||||
|
||||
class GeoResultsWrapper {
|
||||
GeoResults<Leaf> results;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user