@@ -68,8 +68,8 @@ class DocumentSpecification extends Specification {
68
68
def ' should return a list with elements of the specified class' () {
69
69
when :
70
70
Document doc = Document . parse(" {x: 1, y: ['two', 'three'], z: [{a: 'one'}, {b:2}], w: {a: ['One', 'Two']}}" )
71
- .append(' numberList' , Arrays . asList( 10 , 20.5d , 30L ) )
72
- List<String > defaultList = Arrays . asList( ' a' , ' b' , ' c' )
71
+ .append(' numberList' , [ 10 , 20.5d , 30L ] )
72
+ List<String > defaultList = [ ' a' , ' b' , ' c' ]
73
73
74
74
then :
75
75
doc. getList(' y' , String ). get(0 ) == ' two'
@@ -97,7 +97,7 @@ class DocumentSpecification extends Specification {
97
97
def ' should return specified default value when key is not found' () {
98
98
when :
99
99
Document doc = Document . parse(' {x: 1}' )
100
- List<String > defaultList = Arrays . asList( ' a' , ' b' , ' c' )
100
+ List<String > defaultList = [ ' a' , ' b' , ' c' ]
101
101
102
102
then :
103
103
doc. getList(' a' , String , defaultList) == defaultList
@@ -131,10 +131,10 @@ class DocumentSpecification extends Specification {
131
131
Document document = Document . parse(" {a: 1, b: {x: [2, 3, 4], y: {m: 'one', len: 3}}, 'a.b': 'two'}" )
132
132
133
133
then :
134
- document. getEmbedded(List . of( ' notAKey' ) , String ) == null
135
- document. getEmbedded(List . of( ' b' , ' y' , ' notAKey' ) , String ) == null
136
- document. getEmbedded(List . of( ' b' , ' b' , ' m' ) , String ) == null
137
- Document . parse(' {}' ). getEmbedded(List . of( ' a' , ' b' ) , Integer ) == null
134
+ document. getEmbedded([ ' notAKey' ] , String ) == null
135
+ document. getEmbedded([ ' b' , ' y' , ' notAKey' ] , String ) == null
136
+ document. getEmbedded([ ' b' , ' b' , ' m' ] , String ) == null
137
+ Document . parse(' {}' ). getEmbedded([ ' a' , ' b' ] , Integer ) == null
138
138
Document . parse(' {b: 1}' ). getEmbedded([' a' ], Integer ) == null
139
139
Document . parse(' {b: 1}' ). getEmbedded([' a' , ' b' ], Integer ) == null
140
140
Document . parse(' {a: {c: 1}}' ). getEmbedded([' a' , ' b' ], Integer ) == null
@@ -155,24 +155,24 @@ class DocumentSpecification extends Specification {
155
155
.append(' n' , new Document (' date' , date))
156
156
157
157
then :
158
- document. getEmbedded(List . of( ' a' ) , Integer ) == 1
159
- document. getEmbedded(List . of( ' b' , ' x' ) , List ). get(0 ) == 2
160
- document. getEmbedded(List . of( ' b' , ' x' ) , List ). get(1 ) == 3
161
- document. getEmbedded(List . of( ' b' , ' x' ) , List ). get(2 ) == 4
162
- document. getEmbedded(List . of( ' b' , ' y' , ' m' ) , String ) == ' one'
163
- document. getEmbedded(List . of( ' b' , ' y' , ' len' ) , Integer ) == 3
164
- document. getEmbedded(List . of( ' a.b' ) , String ) == ' two'
165
- document. getEmbedded(List . of( ' b' , ' y' ) , Document ). getString(' m' ) == ' one'
166
- document. getEmbedded(List . of( ' b' , ' y' ) , Document ). getInteger(' len' ) == 3
167
-
168
- document. getEmbedded(Arrays . asList( ' l' , ' long' ) , Long ) == 2L
169
- document. getEmbedded(Arrays . asList( ' d' , ' double' ) , Double ) == 3.0d
170
- document. getEmbedded(Arrays . asList( ' l' , ' long' ) , Number ) == 2L
171
- document. getEmbedded(Arrays . asList( ' d' , ' double' ) , Number ) == 3.0d
172
- document. getEmbedded(Arrays . asList( ' t' , ' boolean' ) , Boolean ) == true
173
- document. getEmbedded(Arrays . asList( ' t' , ' x' ) , false ) == false
174
- document. getEmbedded(Arrays . asList( ' o' , ' objectId' ) , ObjectId ) == objectId
175
- document. getEmbedded(Arrays . asList( ' n' , ' date' ) , Date ) == date
158
+ document. getEmbedded([ ' a' ] , Integer ) == 1
159
+ document. getEmbedded([ ' b' , ' x' ] , List ). get(0 ) == 2
160
+ document. getEmbedded([ ' b' , ' x' ] , List ). get(1 ) == 3
161
+ document. getEmbedded([ ' b' , ' x' ] , List ). get(2 ) == 4
162
+ document. getEmbedded([ ' b' , ' y' , ' m' ] , String ) == ' one'
163
+ document. getEmbedded([ ' b' , ' y' , ' len' ] , Integer ) == 3
164
+ document. getEmbedded([ ' a.b' ] , String ) == ' two'
165
+ document. getEmbedded([ ' b' , ' y' ] , Document ). getString(' m' ) == ' one'
166
+ document. getEmbedded([ ' b' , ' y' ] , Document ). getInteger(' len' ) == 3
167
+
168
+ document. getEmbedded([ ' l' , ' long' ] , Long ) == 2L
169
+ document. getEmbedded([ ' d' , ' double' ] , Double ) == 3.0d
170
+ document. getEmbedded([ ' l' , ' long' ] , Number ) == 2L
171
+ document. getEmbedded([ ' d' , ' double' ] , Number ) == 3.0d
172
+ document. getEmbedded([ ' t' , ' boolean' ] , Boolean ) == true
173
+ document. getEmbedded([ ' t' , ' x' ] , false ) == false
174
+ document. getEmbedded([ ' o' , ' objectId' ] , ObjectId ) == objectId
175
+ document. getEmbedded([ ' n' , ' date' ] , Date ) == date
176
176
}
177
177
178
178
def ' should throw an exception getting an embedded value' () {
@@ -186,7 +186,7 @@ class DocumentSpecification extends Specification {
186
186
thrown(IllegalArgumentException )
187
187
188
188
when :
189
- document. getEmbedded(List . of() , String ) == null
189
+ document. getEmbedded([] , String ) == null
190
190
191
191
then :
192
192
thrown(IllegalStateException )
@@ -198,25 +198,25 @@ class DocumentSpecification extends Specification {
198
198
thrown(ClassCastException )
199
199
200
200
when :
201
- document. getEmbedded(List . of( ' b' , ' y' , ' m' ) , Integer )
201
+ document. getEmbedded([ ' b' , ' y' , ' m' ] , Integer )
202
202
203
203
then :
204
204
thrown(ClassCastException )
205
205
206
206
when :
207
- document. getEmbedded(List . of( ' b' , ' x' ) , Document )
207
+ document. getEmbedded([ ' b' , ' x' ] , Document )
208
208
209
209
then :
210
210
thrown(ClassCastException )
211
211
212
212
when :
213
- document. getEmbedded(List . of( ' b' , ' x' , ' m' ) , String )
213
+ document. getEmbedded([ ' b' , ' x' , ' m' ] , String )
214
214
215
215
then :
216
216
thrown(ClassCastException )
217
217
218
218
when :
219
- document. getEmbedded(Arrays . asList( ' b' , ' x' , ' m' ) , ' invalid' )
219
+ document. getEmbedded([ ' b' , ' x' , ' m' ] , ' invalid' )
220
220
221
221
then :
222
222
thrown(ClassCastException )
0 commit comments