@@ -68,8 +68,8 @@ class DocumentSpecification extends Specification {
6868 def ' should return a list with elements of the specified class' () {
6969 when :
7070 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' ]
7373
7474 then :
7575 doc. getList(' y' , String ). get(0 ) == ' two'
@@ -97,7 +97,7 @@ class DocumentSpecification extends Specification {
9797 def ' should return specified default value when key is not found' () {
9898 when :
9999 Document doc = Document . parse(' {x: 1}' )
100- List<String > defaultList = Arrays . asList( ' a' , ' b' , ' c' )
100+ List<String > defaultList = [ ' a' , ' b' , ' c' ]
101101
102102 then :
103103 doc. getList(' a' , String , defaultList) == defaultList
@@ -131,10 +131,10 @@ class DocumentSpecification extends Specification {
131131 Document document = Document . parse(" {a: 1, b: {x: [2, 3, 4], y: {m: 'one', len: 3}}, 'a.b': 'two'}" )
132132
133133 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
138138 Document . parse(' {b: 1}' ). getEmbedded([' a' ], Integer ) == null
139139 Document . parse(' {b: 1}' ). getEmbedded([' a' , ' b' ], Integer ) == null
140140 Document . parse(' {a: {c: 1}}' ). getEmbedded([' a' , ' b' ], Integer ) == null
@@ -155,24 +155,24 @@ class DocumentSpecification extends Specification {
155155 .append(' n' , new Document (' date' , date))
156156
157157 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
176176 }
177177
178178 def ' should throw an exception getting an embedded value' () {
@@ -186,7 +186,7 @@ class DocumentSpecification extends Specification {
186186 thrown(IllegalArgumentException )
187187
188188 when :
189- document. getEmbedded(List . of() , String ) == null
189+ document. getEmbedded([] , String ) == null
190190
191191 then :
192192 thrown(IllegalStateException )
@@ -198,25 +198,25 @@ class DocumentSpecification extends Specification {
198198 thrown(ClassCastException )
199199
200200 when :
201- document. getEmbedded(List . of( ' b' , ' y' , ' m' ) , Integer )
201+ document. getEmbedded([ ' b' , ' y' , ' m' ] , Integer )
202202
203203 then :
204204 thrown(ClassCastException )
205205
206206 when :
207- document. getEmbedded(List . of( ' b' , ' x' ) , Document )
207+ document. getEmbedded([ ' b' , ' x' ] , Document )
208208
209209 then :
210210 thrown(ClassCastException )
211211
212212 when :
213- document. getEmbedded(List . of( ' b' , ' x' , ' m' ) , String )
213+ document. getEmbedded([ ' b' , ' x' , ' m' ] , String )
214214
215215 then :
216216 thrown(ClassCastException )
217217
218218 when :
219- document. getEmbedded(Arrays . asList( ' b' , ' x' , ' m' ) , ' invalid' )
219+ document. getEmbedded([ ' b' , ' x' , ' m' ] , ' invalid' )
220220
221221 then :
222222 thrown(ClassCastException )
0 commit comments