@@ -40,43 +40,47 @@ protected Stream<TestSpec> testData() {
40
40
return Stream .of (
41
41
// Test valid OBJECT_OF with no fields and values
42
42
TestSpec .forStrategy ("Valid OBJECT_OF with only class" , OBJECT_OF_INPUT_STRATEGY )
43
- .calledWithArgumentTypes (DataTypes .STRING ())
43
+ .calledWithArgumentTypes (DataTypes .STRING (). notNull () )
44
44
.calledWithLiteralAt (0 , USER_CLASS_PATH )
45
45
.expectSignature ("f(STRING, [STRING, ANY]*...)" )
46
- .expectArgumentTypes (DataTypes .STRING ()),
46
+ .expectArgumentTypes (DataTypes .STRING (). notNull () ),
47
47
48
48
// Test valid number of arguments (odd number >= 1)
49
49
TestSpec .forStrategy (
50
50
"Valid OBJECT_OF with class and one field and value" ,
51
51
OBJECT_OF_INPUT_STRATEGY )
52
52
.calledWithArgumentTypes (
53
- DataTypes .STRING (), DataTypes .STRING (), DataTypes .INT ())
53
+ DataTypes .STRING ().notNull (),
54
+ DataTypes .STRING ().notNull (),
55
+ DataTypes .INT ())
54
56
.calledWithLiteralAt (0 , USER_CLASS_PATH )
55
57
.calledWithLiteralAt (1 , "field1" )
56
58
.expectArgumentTypes (
57
- DataTypes .STRING (), DataTypes .STRING (), DataTypes .INT ()),
59
+ DataTypes .STRING ().notNull (),
60
+ DataTypes .STRING ().notNull (),
61
+ DataTypes .INT ()),
58
62
59
63
// Test with structured fields
60
64
TestSpec .forStrategy (
61
65
"Valid OBJECT_OF with multiple fields" , OBJECT_OF_INPUT_STRATEGY )
62
66
.calledWithArgumentTypes (
63
- DataTypes .STRING (), // implementation class
64
- DataTypes .STRING (), // field1 name
67
+ DataTypes .STRING (). notNull () , // implementation class
68
+ DataTypes .STRING (). notNull () , // field1 name
65
69
DataTypes .STRUCTURED (
66
70
"c1" ,
67
71
DataTypes .FIELD ("f1" , DataTypes .INT ())), // field1 value
68
- DataTypes .STRING (), // field2 name
72
+ DataTypes .STRING (). notNull () , // field2 name
69
73
DataTypes .STRUCTURED (
70
74
"c2" ,
71
75
DataTypes .FIELD ("f1" , DataTypes .FLOAT ()))) // field2 value
72
76
.calledWithLiteralAt (0 , USER_CLASS_PATH )
73
77
.calledWithLiteralAt (1 , "field1" )
74
78
.calledWithLiteralAt (3 , "field2" )
75
79
.expectArgumentTypes (
76
- DataTypes .STRING (),
77
- DataTypes .STRING (),
80
+ DataTypes .STRING (). notNull () ,
81
+ DataTypes .STRING (). notNull () ,
78
82
DataTypes .STRUCTURED ("c1" , DataTypes .FIELD ("f1" , DataTypes .INT ())),
79
- DataTypes .STRING (),
83
+ DataTypes .STRING (). notNull () ,
80
84
DataTypes .STRUCTURED (
81
85
"c2" , DataTypes .FIELD ("f1" , DataTypes .FLOAT ()))),
82
86
@@ -87,15 +91,15 @@ protected Stream<TestSpec> testData() {
87
91
.calledWithArgumentTypes (DataTypes .NULL ())
88
92
.calledWithLiteralAt (0 , null )
89
93
.expectErrorMessage (
90
- "The first argument must be a STRING/VARCHAR type representing the class name." ),
94
+ "The first argument must be a non-nullable STRING/VARCHAR type representing the class name." ),
91
95
92
96
// Invalid test case - even number of arguments
93
97
TestSpec .forStrategy (
94
98
"Invalid OBJECT_OF with even number of arguments" ,
95
99
OBJECT_OF_INPUT_STRATEGY )
96
100
.calledWithArgumentTypes (
97
- DataTypes .STRING (), // implementation class
98
- DataTypes .STRING ()) // only field name, missing value
101
+ DataTypes .STRING (). notNull () , // implementation class
102
+ DataTypes .STRING (). notNull ()) // only field name, missing value
99
103
.calledWithLiteralAt (0 , USER_CLASS_PATH )
100
104
.expectErrorMessage ("Invalid number of arguments." ),
101
105
@@ -112,38 +116,38 @@ protected Stream<TestSpec> testData() {
112
116
.calledWithLiteralAt (0 , 72 )
113
117
.expectArgumentTypes (DataTypes .INT ())
114
118
.expectErrorMessage (
115
- "The first argument must be a STRING/VARCHAR type representing the class name." ),
119
+ "The first argument must be a non-nullable STRING/VARCHAR type representing the class name." ),
116
120
117
121
// Invalid test case - field name not a string
118
122
TestSpec .forStrategy (
119
123
"OBJECT_OF with non-string field name" , OBJECT_OF_INPUT_STRATEGY )
120
124
.calledWithArgumentTypes (
121
- DataTypes .STRING (), // implementation class
125
+ DataTypes .STRING (). notNull () , // implementation class
122
126
DataTypes .INT (), // field name (not a string)
123
127
DataTypes .INT ()) // field value
124
128
.calledWithLiteralAt (0 , USER_CLASS_PATH )
125
129
.calledWithLiteralAt (1 , 5 )
126
130
.expectArgumentTypes (DataTypes .STRING (), DataTypes .INT (), DataTypes .INT ())
127
131
.expectErrorMessage (
128
- "The field key at position 2 must be a STRING/VARCHAR type, but was INT." ),
132
+ "The field key at position 2 must be a non-nullable STRING/VARCHAR type, but was INT." ),
129
133
130
134
// Invalid test case - repeated field names
131
135
TestSpec .forStrategy (
132
136
"OBJECT_OF with repeated field names" , OBJECT_OF_INPUT_STRATEGY )
133
137
.calledWithArgumentTypes (
134
- DataTypes .STRING (),
135
- DataTypes .STRING (),
138
+ DataTypes .STRING (). notNull () ,
139
+ DataTypes .STRING (). notNull () ,
136
140
DataTypes .INT (),
137
- DataTypes .STRING (),
141
+ DataTypes .STRING (). notNull () ,
138
142
DataTypes .INT ())
139
143
.calledWithLiteralAt (0 , USER_CLASS_PATH )
140
144
.calledWithLiteralAt (1 , "field1" )
141
145
.calledWithLiteralAt (3 , "field1" )
142
146
.expectArgumentTypes (
143
- DataTypes .STRING (),
144
- DataTypes .STRING (),
147
+ DataTypes .STRING (). notNull () ,
148
+ DataTypes .STRING (). notNull () ,
145
149
DataTypes .INT (),
146
- DataTypes .STRING (),
150
+ DataTypes .STRING (). notNull () ,
147
151
DataTypes .INT ())
148
152
.expectErrorMessage ("The field name 'field1' at position 4 is repeated." ));
149
153
}
0 commit comments