File tree Expand file tree Collapse file tree 3 files changed +27
-5
lines changed
main/java/org/springframework/data/util
test/java/org/springframework/data/util Expand file tree Collapse file tree 3 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,10 @@ public class ClassTypeInformation<S> extends TypeDiscoverer<S> {
61
61
62
62
private final Class <S > type ;
63
63
64
+ ClassTypeInformation (Class <?> type ) {
65
+ this (ResolvableType .forType (type ));
66
+ }
67
+
64
68
ClassTypeInformation (ResolvableType type ) {
65
69
super (type );
66
70
this .type = (Class <S >) type .resolve (Object .class );
Original file line number Diff line number Diff line change 42
42
@ SuppressWarnings ({ "deprecation" , "rawtypes" })
43
43
public interface TypeInformation <S > {
44
44
45
- TypeInformation <Collection > COLLECTION = ClassTypeInformation . COLLECTION ;
46
- TypeInformation <List > LIST = ClassTypeInformation . LIST ;
47
- TypeInformation <Set > SET = ClassTypeInformation . SET ;
48
- TypeInformation <Map > MAP = ClassTypeInformation . MAP ;
49
- TypeInformation <Object > OBJECT = ClassTypeInformation . OBJECT ;
45
+ TypeInformation <Collection > COLLECTION = new ClassTypeInformation ( Collection . class ) ;
46
+ TypeInformation <List > LIST = new ClassTypeInformation ( List . class ) ;
47
+ TypeInformation <Set > SET = new ClassTypeInformation ( Set . class ) ;
48
+ TypeInformation <Map > MAP = new ClassTypeInformation ( Map . class ) ;
49
+ TypeInformation <Object > OBJECT = new ClassTypeInformation ( Object . class ) ;
50
50
51
51
/**
52
52
* Creates a new {@link TypeInformation} from the given {@link ResolvableType}.
Original file line number Diff line number Diff line change 45
45
*/
46
46
public class ClassTypeInformationUnitTests {
47
47
48
+ @ Test // GH-3340
49
+ void typeInformationConstantsShouldNotBeNull () {
50
+
51
+ assertThat (ClassTypeInformation .COLLECTION ).isNotNull ();
52
+ assertThat (TypeInformation .COLLECTION ).isNotNull ();
53
+ assertThat (TypeInformation .LIST ).isNotNull ();
54
+ assertThat (TypeInformation .SET ).isNotNull ();
55
+ assertThat (TypeInformation .MAP ).isNotNull ();
56
+ assertThat (TypeInformation .OBJECT ).isNotNull ();
57
+ assertThat (ClassTypeInformation .OBJECT ).isNotNull ();
58
+
59
+ assertThat (TypeInformation .COLLECTION ).isEqualTo (ClassTypeInformation .COLLECTION );
60
+ assertThat (TypeInformation .LIST ).isEqualTo (ClassTypeInformation .LIST );
61
+ assertThat (TypeInformation .SET ).isEqualTo (ClassTypeInformation .SET );
62
+ assertThat (TypeInformation .MAP ).isEqualTo (ClassTypeInformation .MAP );
63
+ assertThat (TypeInformation .OBJECT ).isEqualTo (ClassTypeInformation .OBJECT );
64
+ }
65
+
48
66
@ Test
49
67
public void discoversTypeForSimpleGenericField () {
50
68
You can’t perform that action at this time.
0 commit comments