@@ -58,7 +58,6 @@ class ScalarsFloatTest extends Specification {
5858 def " Float serialize #value into #result (#result.class)" () {
5959 expect :
6060 Scalars.GraphQLFloat . getCoercing(). serialize(value, GraphQLContext . default, Locale . default) == result
61- Scalars.GraphQLFloat . getCoercing(). parseValue(value, GraphQLContext . default, Locale . default) == result
6261
6362 where :
6463 value | result
@@ -84,7 +83,6 @@ class ScalarsFloatTest extends Specification {
8483 def " Float serialize #value into #result (#result.class) with deprecated methods" () {
8584 expect :
8685 Scalars.GraphQLFloat . getCoercing(). serialize(value) == result // Retain deprecated method for coverage
87- Scalars.GraphQLFloat . getCoercing(). parseValue(value) == result // Retain deprecated method for coverage
8886
8987 where :
9088 value | result
@@ -131,6 +129,51 @@ class ScalarsFloatTest extends Specification {
131129 Float . NEGATIVE_INFINITY . toString() | _
132130 }
133131
132+ @Unroll
133+ def " Float parseValue #value into #result (#result.class)" () {
134+ expect :
135+ Scalars.GraphQLFloat . getCoercing(). parseValue(value, GraphQLContext . default, Locale . default) == result
136+
137+ where :
138+ value | result
139+ 42.0000d | 42
140+ new Integer (42 ) | 42
141+ new BigInteger (" 42" ) | 42
142+ new BigDecimal (" 42" ) | 42
143+ new BigDecimal (" 4.2" ) | 4.2d
144+ 42.3f | 42.3d
145+ 42.0d | 42d
146+ new Byte (" 42" ) | 42
147+ new Short (" 42" ) | 42
148+ 1234567l | 1234567d
149+ new AtomicInteger (42 ) | 42
150+ Double . MAX_VALUE | Double . MAX_VALUE
151+ Double . MIN_VALUE | Double . MIN_VALUE
152+ }
153+
154+ @Unroll
155+ def " Float parseValue #value into #result (#result.class) with deprecated methods" () {
156+ expect :
157+ Scalars.GraphQLFloat . getCoercing(). parseValue(value) == result // Retain deprecated method for coverage
158+
159+ where :
160+ value | result
161+ 42.0000d | 42
162+ new Integer (42 ) | 42
163+ new BigInteger (" 42" ) | 42
164+ new BigDecimal (" 42" ) | 42
165+ new BigDecimal (" 4.2" ) | 4.2d
166+ 42.3f | 42.3d
167+ 42.0d | 42d
168+ new Byte (" 42" ) | 42
169+ new Short (" 42" ) | 42
170+ 1234567l | 1234567d
171+ new AtomicInteger (42 ) | 42
172+ Double . MAX_VALUE | Double . MAX_VALUE
173+ Double . MIN_VALUE | Double . MIN_VALUE
174+ }
175+
176+
134177 @Unroll
135178 def " parseValue throws exception for invalid input #value" () {
136179 when :
@@ -154,6 +197,9 @@ class ScalarsFloatTest extends Specification {
154197 Float . POSITIVE_INFINITY . toString() | _
155198 Float . NEGATIVE_INFINITY | _
156199 Float . NEGATIVE_INFINITY . toString() | _
200+ " 42" | _
201+ " 42.123" | _
202+ " -1" | _
157203 }
158204
159205}
0 commit comments