Skip to content

Fixed up failing compilation and tests #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ query {
</tr>
<tr>
<td><pre lang="graphql">
scalar URL
scalar Url
@specifiedBy(url:
"https://www.w3.org/Addressing/URL/url-spec.txt"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
/**
* Access this via {@link graphql.scalars.ExtendedScalars#HexColorCode}
* See the <a href="https://en.wikipedia.org/wiki/Web_colors">Web colors</a> for more details.
* @implNote Supports the following formats: #RGB, #RGBA, #RRGGBB, #RRGGBBAA. Need to be prefixed with '#'
* <p>
* Supports the following formats: #RGB, #RGBA, #RRGGBB, #RRGGBBAA. Need to be prefixed with '#'
*/
public class HexColorCodeScalar {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class HexColorCodeScalarTest extends Specification {
then:
result.equals(expectedValue)
where:
input | expectedValue
"#ff0000" | mkColor(0xff, 0, 0)
"#123" | mkColor(0x11, 0x22, 0x33)
"#11223344" | mkColor(0x11, 0x22, 0x33, 0x44)
"#1234" | mkColor(0x11, 0x22, 0x33, 0x44)
input | expectedValue
"#ff0000" | mkColor(0xff, 0, 0)
"#123" | mkColor(0x11, 0x22, 0x33)
"#11223344" | mkColor(0x11, 0x22, 0x33, 0x44)
"#1234" | mkColor(0x11, 0x22, 0x33, 0x44)
}

@Unroll
Expand All @@ -47,12 +47,12 @@ class HexColorCodeScalarTest extends Specification {
then:
result == expectedValue
where:
input | expectedValue
"#ff0000" | "#ff0000"
"#123" | "#112233"
"#11223344" | "#11223344"
"#1234" | "#11223344"
mkColor(0x21, 0x23, 0x33) | "#212333"
input | expectedValue
"#ff0000" | "#ff0000"
"#123" | "#112233"
"#11223344" | "#11223344"
"#1234" | "#11223344"
mkColor(0x21, 0x23, 0x33) | "#212333"
mkColor(0x21, 0x23, 0x33, 0x44) | "#21233344"
}

Expand All @@ -63,30 +63,30 @@ class HexColorCodeScalarTest extends Specification {
then:
result.isEqualTo(expectedValue)
where:
input | expectedValue
"#ff0000" | new StringValue("#ff0000")
"#123" | new StringValue("#112233")
"#11223344" | new StringValue("#11223344")
"#1234" | new StringValue("#11223344")
mkColor(0x21, 0x23, 0x33) | new StringValue("#212333")
input | expectedValue
"#ff0000" | new StringValue("#ff0000")
"#123" | new StringValue("#112233")
"#11223344" | new StringValue("#11223344")
"#1234" | new StringValue("#11223344")
mkColor(0x21, 0x23, 0x33) | new StringValue("#212333")
mkColor(0x21, 0x23, 0x33, 0x44) | new StringValue("#21233344")
}

@Unroll
def "parseValue throws exception for invalid input #value"() {
def "parseValue throws exception for invalid input #input"() {
when:
def result = coercing.parseValue(input)
then:
thrown(CoercingParseValueException)
where:
input | _
"ff000" | _
"" | _
"not a hex code" | _
"42.3" | _
new Double(42.3) | _
new Float(42.3) | _
new Object() | _
input | _
"ff000" | _
"" | _
"not a hex code" | _
"42.3" | _
Double.valueOf(42.3) | _
Float.valueOf(42.3) | _
new Object() | _
}

}
Loading