DATACMNS-1101 - Remove Optional from TypeDiscoverer API.

This commit is contained in:
Mark Paluch
2017-06-29 13:11:10 +02:00
committed by Oliver Gierke
parent 2064c72a85
commit 0493d131e0
13 changed files with 312 additions and 329 deletions

View File

@@ -34,6 +34,7 @@ import org.springframework.data.util.TypeInformation;
* Unit tests for {@link DefaultTypeMapper}.
*
* @author Oliver Gierke
* @author Mark Paluch
*/
@RunWith(MockitoJUnitRunner.class)
public class DefaultTypeMapperUnitTests {
@@ -81,8 +82,7 @@ public class DefaultTypeMapperUnitTests {
public void specializesRawSourceTypeUsingGenericContext() {
ClassTypeInformation<Foo> root = ClassTypeInformation.from(Foo.class);
TypeInformation<?> propertyType = root.getProperty("abstractBar")
.orElseThrow(() -> new IllegalStateException("Property abstractBar not found!"));
TypeInformation<?> propertyType = root.getProperty("abstractBar");
TypeInformation<?> barType = ClassTypeInformation.from(Bar.class);
doReturn(Alias.of(barType)).when(accessor).readAliasFrom(source);
@@ -95,8 +95,7 @@ public class DefaultTypeMapperUnitTests {
TypeInformation<?> typeInformation = TypeInformation.class.cast(result);
assertThat(typeInformation.getType()).isEqualTo(Bar.class);
assertThat(typeInformation.getProperty("field"))
.hasValueSatisfying(it -> assertThat(it.getType()).isEqualTo(Character.class));
assertThat(typeInformation.getProperty("field").getType()).isEqualTo(Character.class);
}
static class TypeWithAbstractGenericType<T> {