Skip to content

Commit 4f85f91

Browse files
Using the ExtendedScalars reference in tests
1 parent 9478eb7 commit 4f85f91

File tree

6 files changed

+40
-40
lines changed

6 files changed

+40
-40
lines changed

src/main/java/graphql/scalars/java/JavaPrimitives.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public Long parseLiteral(Object input) {
116116
/**
117117
* This represents the "Short" type which is a representation of java.lang.Short
118118
*/
119-
public static final GraphQLScalarType GraphQLShort = new GraphQLScalarType("Short", "Built-in Short as Int", new Coercing<Short, Short>() {
119+
public static final GraphQLScalarType GraphQLShort = new GraphQLScalarType("Short", "Short as Int", new Coercing<Short, Short>() {
120120

121121
private Short convertImpl(Object input) {
122122
if (input instanceof Short) {
@@ -181,7 +181,7 @@ public Short parseLiteral(Object input) {
181181
/**
182182
* This represents the "Byte" type which is a representation of java.lang.Byte
183183
*/
184-
public static final GraphQLScalarType GraphQLByte = new GraphQLScalarType("Byte", "Built-in Byte as Int", new Coercing<Byte, Byte>() {
184+
public static final GraphQLScalarType GraphQLByte = new GraphQLScalarType("Byte", "Byte as Int", new Coercing<Byte, Byte>() {
185185

186186
private Byte convertImpl(Object input) {
187187
if (input instanceof Byte) {
@@ -247,7 +247,7 @@ public Byte parseLiteral(Object input) {
247247
/**
248248
* This represents the "BigInteger" type which is a representation of java.math.BigInteger
249249
*/
250-
public static final GraphQLScalarType GraphQLBigInteger = new GraphQLScalarType("BigInteger", "Built-in java.math.BigInteger", new Coercing<BigInteger, BigInteger>() {
250+
public static final GraphQLScalarType GraphQLBigInteger = new GraphQLScalarType("BigInteger", "java.math.BigInteger", new Coercing<BigInteger, BigInteger>() {
251251

252252
private BigInteger convertImpl(Object input) {
253253
if (isNumberIsh(input)) {
@@ -319,7 +319,7 @@ public BigInteger parseLiteral(Object input) {
319319
/**
320320
* This represents the "BigDecimal" type which is a representation of java.math.BigDecimal
321321
*/
322-
public static final GraphQLScalarType GraphQLBigDecimal = new GraphQLScalarType("BigDecimal", "Built-in java.math.BigDecimal", new Coercing<BigDecimal, BigDecimal>() {
322+
public static final GraphQLScalarType GraphQLBigDecimal = new GraphQLScalarType("BigDecimal", "java.math.BigDecimal", new Coercing<BigDecimal, BigDecimal>() {
323323

324324
private BigDecimal convertImpl(Object input) {
325325
if (isNumberIsh(input)) {
@@ -380,7 +380,7 @@ public BigDecimal parseLiteral(Object input) {
380380
/**
381381
* This represents the "Char" type which is a representation of java.lang.Character
382382
*/
383-
public static final GraphQLScalarType GraphQLChar = new GraphQLScalarType("Char", "Built-in Char as Character", new Coercing<Character, Character>() {
383+
public static final GraphQLScalarType GraphQLChar = new GraphQLScalarType("Char", "Char as Character", new Coercing<Character, Character>() {
384384

385385
private Character convertImpl(Object input) {
386386
if (input instanceof String && ((String) input).length() == 1) {

src/test/groovy/graphql/scalars/java/ScalarsBigDecimalTest.groovy

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package graphql.scalars.java
22

3-
import graphql.Scalars
43
import graphql.language.BooleanValue
54
import graphql.language.FloatValue
65
import graphql.language.IntValue
76
import graphql.language.StringValue
7+
import graphql.scalars.ExtendedScalars
88
import graphql.schema.CoercingParseLiteralException
99
import graphql.schema.CoercingParseValueException
1010
import graphql.schema.CoercingSerializeException
@@ -18,7 +18,7 @@ class ScalarsBigDecimalTest extends Specification {
1818
@Unroll
1919
def "BigDecimal parse literal #literal.value as #result"() {
2020
expect:
21-
JavaPrimitives.GraphQLBigDecimal.getCoercing().parseLiteral(literal) == result
21+
ExtendedScalars.GraphQLBigDecimal.getCoercing().parseLiteral(literal) == result
2222

2323
where:
2424
literal | result
@@ -31,7 +31,7 @@ class ScalarsBigDecimalTest extends Specification {
3131
@Unroll
3232
def "BigDecimal returns null for invalid #literal"() {
3333
when:
34-
JavaPrimitives.GraphQLBigDecimal.getCoercing().parseLiteral(literal)
34+
ExtendedScalars.GraphQLBigDecimal.getCoercing().parseLiteral(literal)
3535
then:
3636
thrown(CoercingParseLiteralException)
3737

@@ -44,8 +44,8 @@ class ScalarsBigDecimalTest extends Specification {
4444
@Unroll
4545
def "BigDecimal serialize #value into #result (#result.class)"() {
4646
expect:
47-
JavaPrimitives.GraphQLBigDecimal.getCoercing().serialize(value) == result
48-
JavaPrimitives.GraphQLBigDecimal.getCoercing().parseValue(value) == result
47+
ExtendedScalars.GraphQLBigDecimal.getCoercing().serialize(value) == result
48+
ExtendedScalars.GraphQLBigDecimal.getCoercing().parseValue(value) == result
4949

5050
where:
5151
value | result
@@ -67,7 +67,7 @@ class ScalarsBigDecimalTest extends Specification {
6767
@Unroll
6868
def "serialize throws exception for invalid input #value"() {
6969
when:
70-
JavaPrimitives.GraphQLBigDecimal.getCoercing().serialize(value)
70+
ExtendedScalars.GraphQLBigDecimal.getCoercing().serialize(value)
7171
then:
7272
thrown(CoercingSerializeException)
7373

@@ -81,7 +81,7 @@ class ScalarsBigDecimalTest extends Specification {
8181
@Unroll
8282
def "parseValue throws exception for invalid input #value"() {
8383
when:
84-
JavaPrimitives.GraphQLBigDecimal.getCoercing().parseValue(value)
84+
ExtendedScalars.GraphQLBigDecimal.getCoercing().parseValue(value)
8585
then:
8686
thrown(CoercingParseValueException)
8787

src/test/groovy/graphql/scalars/java/ScalarsByteTest.groovy

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package graphql.scalars.java
22

3-
import graphql.Scalars
3+
import graphql.scalars.ExtendedScalars
44
import graphql.language.FloatValue
55
import graphql.language.IntValue
66
import graphql.language.StringValue
@@ -17,7 +17,7 @@ class ScalarsByteTest extends Specification {
1717
@Unroll
1818
def "Byte parse literal #literal.value as #result"() {
1919
expect:
20-
JavaPrimitives.GraphQLByte.getCoercing().parseLiteral(literal) == result
20+
ExtendedScalars.GraphQLByte.getCoercing().parseLiteral(literal) == result
2121

2222
where:
2323
literal | result
@@ -30,7 +30,7 @@ class ScalarsByteTest extends Specification {
3030
@Unroll
3131
def "Byte returns null for invalid #literal"() {
3232
when:
33-
JavaPrimitives.GraphQLByte.getCoercing().parseLiteral(literal)
33+
ExtendedScalars.GraphQLByte.getCoercing().parseLiteral(literal)
3434
then:
3535
thrown(CoercingParseLiteralException)
3636

@@ -49,8 +49,8 @@ class ScalarsByteTest extends Specification {
4949
@Unroll
5050
def "Byte serialize #value into #result (#result.class)"() {
5151
expect:
52-
JavaPrimitives.GraphQLByte.getCoercing().serialize(value) == result
53-
JavaPrimitives.GraphQLByte.getCoercing().parseValue(value) == result
52+
ExtendedScalars.GraphQLByte.getCoercing().serialize(value) == result
53+
ExtendedScalars.GraphQLByte.getCoercing().parseValue(value) == result
5454

5555
where:
5656
value | result
@@ -74,7 +74,7 @@ class ScalarsByteTest extends Specification {
7474
@Unroll
7575
def "serialize throws exception for invalid input #value"() {
7676
when:
77-
JavaPrimitives.GraphQLByte.getCoercing().serialize(value)
77+
ExtendedScalars.GraphQLByte.getCoercing().serialize(value)
7878
then:
7979
thrown(CoercingSerializeException)
8080

@@ -95,7 +95,7 @@ class ScalarsByteTest extends Specification {
9595
@Unroll
9696
def "parseValue throws exception for invalid input #value"() {
9797
when:
98-
JavaPrimitives.GraphQLByte.getCoercing().parseValue(value)
98+
ExtendedScalars.GraphQLByte.getCoercing().parseValue(value)
9999
then:
100100
thrown(CoercingParseValueException)
101101

src/test/groovy/graphql/scalars/java/ScalarsCharTest.groovy

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package graphql.scalars.java
22

3-
import graphql.Scalars
3+
import graphql.scalars.ExtendedScalars
44
import graphql.language.IntValue
55
import graphql.language.StringValue
66
import graphql.schema.CoercingParseLiteralException
@@ -14,7 +14,7 @@ class ScalarsCharTest extends Specification {
1414
@Unroll
1515
def "Char parse literal #literal.value as #result"() {
1616
expect:
17-
JavaPrimitives.GraphQLChar.getCoercing().parseLiteral(literal) == result
17+
ExtendedScalars.GraphQLChar.getCoercing().parseLiteral(literal) == result
1818

1919
where:
2020
literal | result
@@ -26,7 +26,7 @@ class ScalarsCharTest extends Specification {
2626
@Unroll
2727
def "Short returns null for invalid #literal"() {
2828
when:
29-
JavaPrimitives.GraphQLChar.getCoercing().parseLiteral(literal)
29+
ExtendedScalars.GraphQLChar.getCoercing().parseLiteral(literal)
3030
then:
3131
thrown(CoercingParseLiteralException)
3232

@@ -39,8 +39,8 @@ class ScalarsCharTest extends Specification {
3939
@Unroll
4040
def "Short serialize #value into #result (#result.class)"() {
4141
expect:
42-
JavaPrimitives.GraphQLChar.getCoercing().serialize(value) == result
43-
JavaPrimitives.GraphQLChar.getCoercing().parseValue(value) == result
42+
ExtendedScalars.GraphQLChar.getCoercing().serialize(value) == result
43+
ExtendedScalars.GraphQLChar.getCoercing().parseValue(value) == result
4444

4545
where:
4646
value | result
@@ -51,7 +51,7 @@ class ScalarsCharTest extends Specification {
5151
@Unroll
5252
def "serialize throws exception for invalid input #value"() {
5353
when:
54-
JavaPrimitives.GraphQLChar.getCoercing().serialize(value)
54+
ExtendedScalars.GraphQLChar.getCoercing().serialize(value)
5555
then:
5656
thrown(CoercingSerializeException)
5757

@@ -66,7 +66,7 @@ class ScalarsCharTest extends Specification {
6666
@Unroll
6767
def "parseValue throws exception for invalid input #value"() {
6868
when:
69-
JavaPrimitives.GraphQLChar.getCoercing().parseValue(value)
69+
ExtendedScalars.GraphQLChar.getCoercing().parseValue(value)
7070
then:
7171
thrown(CoercingParseValueException)
7272

src/test/groovy/graphql/scalars/java/ScalarsLongTest.groovy

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package graphql.scalars.java
22

3-
import graphql.Scalars
3+
import graphql.scalars.ExtendedScalars
44
import graphql.language.FloatValue
55
import graphql.language.IntValue
66
import graphql.language.StringValue
@@ -23,7 +23,7 @@ class ScalarsLongTest extends Specification {
2323
@Unroll
2424
def "Long parse literal #literal.value as #result"() {
2525
expect:
26-
JavaPrimitives.GraphQLLong.getCoercing().parseLiteral(literal) == result
26+
ExtendedScalars.GraphQLLong.getCoercing().parseLiteral(literal) == result
2727

2828
where:
2929
literal | result
@@ -38,7 +38,7 @@ class ScalarsLongTest extends Specification {
3838
@Unroll
3939
def "Long returns null for invalid #literal"() {
4040
when:
41-
JavaPrimitives.GraphQLLong.getCoercing().parseLiteral(literal)
41+
ExtendedScalars.GraphQLLong.getCoercing().parseLiteral(literal)
4242
then:
4343
thrown(CoercingParseLiteralException)
4444

@@ -54,8 +54,8 @@ class ScalarsLongTest extends Specification {
5454
@Unroll
5555
def "Long serialize #value into #result (#result.class)"() {
5656
expect:
57-
JavaPrimitives.GraphQLLong.getCoercing().serialize(value) == result
58-
JavaPrimitives.GraphQLLong.getCoercing().parseValue(value) == result
57+
ExtendedScalars.GraphQLLong.getCoercing().serialize(value) == result
58+
ExtendedScalars.GraphQLLong.getCoercing().parseValue(value) == result
5959

6060
where:
6161
value | result
@@ -80,7 +80,7 @@ class ScalarsLongTest extends Specification {
8080
@Unroll
8181
def "serialize throws exception for invalid input #value"() {
8282
when:
83-
JavaPrimitives.GraphQLLong.getCoercing().serialize(value)
83+
ExtendedScalars.GraphQLLong.getCoercing().serialize(value)
8484
then:
8585
thrown(CoercingSerializeException)
8686

@@ -99,7 +99,7 @@ class ScalarsLongTest extends Specification {
9999
@Unroll
100100
def "parseValue throws exception for invalid input #value"() {
101101
when:
102-
JavaPrimitives.GraphQLLong.getCoercing().parseValue(value)
102+
ExtendedScalars.GraphQLLong.getCoercing().parseValue(value)
103103
then:
104104
thrown(CoercingParseValueException)
105105

src/test/groovy/graphql/scalars/java/ScalarsShortTest.groovy

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package graphql.scalars.java
22

3-
import graphql.Scalars
43
import graphql.language.FloatValue
54
import graphql.language.IntValue
65
import graphql.language.StringValue
6+
import graphql.scalars.ExtendedScalars
77
import graphql.schema.CoercingParseLiteralException
88
import graphql.schema.CoercingParseValueException
99
import graphql.schema.CoercingSerializeException
@@ -17,7 +17,7 @@ class ScalarsShortTest extends Specification {
1717
@Unroll
1818
def "Short parse literal #literal.value as #result"() {
1919
expect:
20-
JavaPrimitives.GraphQLShort.getCoercing().parseLiteral(literal) == result
20+
ExtendedScalars.GraphQLShort.getCoercing().parseLiteral(literal) == result
2121

2222
where:
2323
literal | result
@@ -30,7 +30,7 @@ class ScalarsShortTest extends Specification {
3030
@Unroll
3131
def "Short returns null for invalid #literal"() {
3232
when:
33-
JavaPrimitives.GraphQLShort.getCoercing().parseLiteral(literal)
33+
ExtendedScalars.GraphQLShort.getCoercing().parseLiteral(literal)
3434
then:
3535
thrown(CoercingParseLiteralException)
3636

@@ -48,8 +48,8 @@ class ScalarsShortTest extends Specification {
4848
@Unroll
4949
def "Short serialize #value into #result (#result.class)"() {
5050
expect:
51-
JavaPrimitives.GraphQLShort.getCoercing().serialize(value) == result
52-
JavaPrimitives.GraphQLShort.getCoercing().parseValue(value) == result
51+
ExtendedScalars.GraphQLShort.getCoercing().serialize(value) == result
52+
ExtendedScalars.GraphQLShort.getCoercing().parseValue(value) == result
5353

5454
where:
5555
value | result
@@ -73,7 +73,7 @@ class ScalarsShortTest extends Specification {
7373
@Unroll
7474
def "serialize throws exception for invalid input #value"() {
7575
when:
76-
JavaPrimitives.GraphQLShort.getCoercing().serialize(value)
76+
ExtendedScalars.GraphQLShort.getCoercing().serialize(value)
7777
then:
7878
thrown(CoercingSerializeException)
7979

@@ -94,7 +94,7 @@ class ScalarsShortTest extends Specification {
9494
@Unroll
9595
def "parseValue throws exception for invalid input #value"() {
9696
when:
97-
JavaPrimitives.GraphQLShort.getCoercing().parseValue(value)
97+
ExtendedScalars.GraphQLShort.getCoercing().parseValue(value)
9898
then:
9999
thrown(CoercingParseValueException)
100100

0 commit comments

Comments
 (0)