Test cleanup: typeResolver builder on unions and interfaces, applied directive tests, and more#2954
Test cleanup: typeResolver builder on unions and interfaces, applied directive tests, and more#2954
Conversation
| * @return this builder | ||
| * | ||
| * @deprecated use {@link graphql.schema.GraphQLCodeRegistry.Builder#typeResolver(GraphQLInterfaceType, TypeResolver)} instead | ||
| */ |
There was a problem hiding this comment.
Add doc to make the alternative clearer
| * @return this builder | ||
| * | ||
| * @deprecated use {@link graphql.schema.GraphQLCodeRegistry.Builder#typeResolver(GraphQLUnionType, TypeResolver)} instead | ||
| */ |
There was a problem hiding this comment.
Add doc to make the alternative clearer
| e.message.contains("an illegal value for the argument ") | ||
| } | ||
|
|
||
| def "Applied schema directives arguments are validated for programmatic schemas"() { |
| @Override | ||
| InstrumentationContext<ExecutionResult> beginExecution(InstrumentationExecutionParameters parameters) { | ||
| assert parameters.getInstrumentationState() == instrumentationState | ||
| assert parameters.getInstrumentationState() == instrumentationState // Retain for test coverage |
There was a problem hiding this comment.
Everything in this file is intentionally deprecated
| .type(GraphQLString)) | ||
| .build()) | ||
| .defaultValue(new FooBar()) | ||
| .defaultValue(new FooBar()) // Retain for test coverage. There is no alternative method that sets an internal value. |
There was a problem hiding this comment.
The alternatives are defaultValueLiteral(Value) or defaultValueProgrammatic(Object), neither of which work in this case.
|
|
||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
These are old tests, a typeResolver is no longer required on the union/interface type
| intDirective.name == "intDirective" | ||
| intDirective.arguments.size() == 1 | ||
| def directiveArg = intDirective.getArgument("inception") | ||
| def intAppliedDirective = argInt.getAppliedDirective("intDirective") |
There was a problem hiding this comment.
Key change: the applied directive contains the value, and the directive contains the default value
|
|
||
| class TypesImplementInterfacesTest extends Specification { | ||
|
|
||
| TypeResolver typeResolver = new TypeResolver() { |
There was a problem hiding this comment.
These are older tests, typeResolver not required directly on interface/union type
| } | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
I halways hated that new line
There was a problem hiding this comment.
Unnecessary new lines drive me
nuts
|
|
||
| class TypeAndFieldRuleTest extends Specification { | ||
|
|
||
|
|
There was a problem hiding this comment.
that new line has bugged me forever!
| e.message == "invalid schema:\n\"InputType\" must define one or more fields." | ||
| } | ||
|
|
||
|
|
| def e = thrown(InvalidSchemaException) | ||
| e.message.contains("Invalid argument 'arg' for applied directive of name 'cached'") | ||
| } | ||
|
|
| then: | ||
| interfaceType.getName() == "TestInterfaceType" | ||
| interfaceType.getFieldDefinition("NAME").getType() == GraphQLInt | ||
| } |
bbakerman
left a comment
There was a problem hiding this comment.
Great detective work. Getting rid of deprecation is harder than it looks
|
Dont forget to set a target milestone on PRs |
This PR fixes more tests with deprecated methods.
This is the last wave of Groovy test fixes. Next PR will fix deprecated usages in a few Java test/util files.