@@ -105,7 +105,7 @@ void convertsStringsToPrimitiveWrapperTypes() {
105
105
@ ValueSource (classes = { char .class , boolean .class , short .class , byte .class , int .class , long .class , float .class ,
106
106
double .class , void .class })
107
107
void throwsExceptionForNullToPrimitiveTypeConversion (Class <?> type ) {
108
- TypeDescriptor typeDescriptor = TypeDescriptor .forType (type );
108
+ TypeDescriptor typeDescriptor = TypeDescriptor .forClass (type );
109
109
110
110
assertThat (canConvert (null , typeDescriptor )).isFalse ();
111
111
assertThatExceptionOfType (ConversionException .class ) //
@@ -117,7 +117,7 @@ void throwsExceptionForNullToPrimitiveTypeConversion(Class<?> type) {
117
117
@ ValueSource (classes = { Boolean .class , Character .class , Short .class , Byte .class , Integer .class , Long .class ,
118
118
Float .class , Double .class })
119
119
void throwsExceptionWhenConvertingTheWordNullToPrimitiveWrapperType (Class <?> type ) {
120
- TypeDescriptor typeDescriptor = TypeDescriptor .forType (type );
120
+ TypeDescriptor typeDescriptor = TypeDescriptor .forClass (type );
121
121
122
122
assertThat (canConvert ("null" , typeDescriptor )).isTrue ();
123
123
assertThatExceptionOfType (ConversionException .class ) //
@@ -132,7 +132,7 @@ void throwsExceptionWhenConvertingTheWordNullToPrimitiveWrapperType(Class<?> typ
132
132
133
133
@ Test
134
134
void throwsExceptionOnInvalidStringForPrimitiveTypes () {
135
- TypeDescriptor charDescriptor = TypeDescriptor .forType (char .class );
135
+ TypeDescriptor charDescriptor = TypeDescriptor .forClass (char .class );
136
136
137
137
assertThat (canConvert ("ab" , charDescriptor )).isTrue ();
138
138
assertThatExceptionOfType (ConversionException .class ) //
@@ -141,7 +141,7 @@ void throwsExceptionOnInvalidStringForPrimitiveTypes() {
141
141
.havingCause () //
142
142
.withMessage ("String must have length of 1: ab" );
143
143
144
- TypeDescriptor booleanDescriptor = TypeDescriptor .forType (boolean .class );
144
+ TypeDescriptor booleanDescriptor = TypeDescriptor .forClass (boolean .class );
145
145
146
146
assertThat (canConvert ("tru" , booleanDescriptor )).isTrue ();
147
147
assertThatExceptionOfType (ConversionException .class ) //
@@ -167,7 +167,7 @@ void throwsExceptionOnInvalidStringForPrimitiveTypes() {
167
167
168
168
@ Test
169
169
void throwsExceptionWhenImplicitConversionIsUnsupported () {
170
- TypeDescriptor typeDescriptor = TypeDescriptor .forType (Enigma .class );
170
+ TypeDescriptor typeDescriptor = TypeDescriptor .forClass (Enigma .class );
171
171
172
172
assertThat (canConvert ("foo" , typeDescriptor )).isFalse ();
173
173
assertThatExceptionOfType (ConversionException .class ) //
@@ -251,7 +251,7 @@ void convertsStringToClassWithCustomTypeFromDifferentClassLoader() throws Except
251
251
var declaringExecutable = ReflectionSupport .findMethod (customType , "foo" ).get ();
252
252
assertThat (declaringExecutable .getDeclaringClass ().getClassLoader ()).isSameAs (testClassLoader );
253
253
254
- var typeDescriptor = TypeDescriptor .forType (Class .class );
254
+ var typeDescriptor = TypeDescriptor .forClass (Class .class );
255
255
assertThat (canConvert (customTypeName , typeDescriptor )).isTrue ();
256
256
257
257
var clazz = (Class <?>) convert (customTypeName , typeDescriptor , classLoader (declaringExecutable ));
@@ -332,7 +332,7 @@ void convertsStringToUUID() {
332
332
// -------------------------------------------------------------------------
333
333
334
334
private void assertConverts (Object input , Class <?> targetClass , Object expectedOutput ) {
335
- TypeDescriptor typeDescriptor = TypeDescriptor .forType (targetClass );
335
+ TypeDescriptor typeDescriptor = TypeDescriptor .forClass (targetClass );
336
336
337
337
assertThat (canConvert (input , typeDescriptor )).isTrue ();
338
338
@@ -344,15 +344,15 @@ private void assertConverts(Object input, Class<?> targetClass, Object expectedO
344
344
}
345
345
346
346
private boolean canConvert (Object input , TypeDescriptor targetClass ) {
347
- return DefaultConverter .INSTANCE .canConvert (input , targetClass );
347
+ return DefaultConverter .INSTANCE .canConvert (input , TypeDescriptor . forInstance ( input ), targetClass );
348
348
}
349
349
350
350
private Object convert (Object input , TypeDescriptor targetClass ) {
351
351
return convert (input , targetClass , classLoader ());
352
352
}
353
353
354
354
private Object convert (Object input , TypeDescriptor targetClass , ClassLoader classLoader ) {
355
- return DefaultConverter .INSTANCE .convert (input , targetClass , classLoader );
355
+ return DefaultConverter .INSTANCE .convert (input , TypeDescriptor . forInstance ( input ), targetClass , classLoader );
356
356
}
357
357
358
358
private static ClassLoader classLoader () {
0 commit comments