File tree Expand file tree Collapse file tree 5 files changed +110
-66
lines changed
src/test/groovy/com/coxautodev/graphql/tools Expand file tree Collapse file tree 5 files changed +110
-66
lines changed Original file line number Diff line number Diff line change @@ -24,23 +24,22 @@ class GenericResolverSpec extends Specification {
2424 noExceptionThrown()
2525 }
2626
27- }
28-
29- class QueryResolver implements GraphQLQueryResolver {
30- Bar getBar () {
31- return new Bar ()
27+ class QueryResolver implements GraphQLQueryResolver {
28+ Bar getBar () {
29+ return new Bar ()
30+ }
3231 }
33- }
3432
35- class Bar {
36- }
33+ class Bar {
34+ }
3735
38- abstract class FooResolver <T> {
39- String getValue (T foo ) {
40- return " value"
36+ abstract class FooResolver <T> {
37+ String getValue (T foo ) {
38+ return " value"
39+ }
4140 }
42- }
4341
44- class BarResolver extends FooResolver<Bar > implements GraphQLResolver<Bar > {
42+ class BarResolver extends FooResolver<Bar > implements GraphQLResolver<Bar > {
4543
44+ }
4645}
Original file line number Diff line number Diff line change @@ -237,19 +237,19 @@ class MethodFieldResolverDataFetcherSpec extends Specification {
237237 .subscriptionStrategy(executionStrategy)
238238 .build()
239239 }
240- }
241240
242- class DataClass {
243- private static final String name = "Data Class Name"
241+ class DataClass {
242+ private static final String name = "Data Class Name"
244243
245- String getName() {
246- name
244+ String getName() {
245+ name
246+ }
247247 }
248- }
249248
250- class InputClass {
251- String name
252- }
249+ static class InputClass {
250+ String name
251+ }
253252
254- class ContextClass {
253+ class ContextClass {
254+ }
255255}
Original file line number Diff line number Diff line change @@ -51,30 +51,30 @@ class MultiResolverSpec extends Specification {
5151 then :
5252 data. person
5353 }
54- }
5554
56- class QueryWithPersonResolver implements GraphQLQueryResolver {
57- Person getPerson () {
58- new Person ()
55+ class QueryWithPersonResolver implements GraphQLQueryResolver {
56+ Person getPerson () {
57+ new Person ()
58+ }
5959 }
60- }
6160
62- class Person {
61+ class Person {
6362
64- }
63+ }
6564
66- class Friend {
67- String name
68- }
65+ class Friend {
66+ String name
67+ }
6968
70- class PersonFriendResolver implements GraphQLResolver<Person > {
71- List<Friend > friends (Person person , String friendName ) {
72- Collections . emptyList()
69+ class PersonFriendResolver implements GraphQLResolver<Person > {
70+ List<Friend > friends (Person person , String friendName ) {
71+ Collections . emptyList()
72+ }
7373 }
74- }
7574
76- class PersonNameResolver implements GraphQLResolver<Person > {
77- String name (Person person ) {
78- " name"
75+ class PersonNameResolver implements GraphQLResolver<Person > {
76+ String name (Person person ) {
77+ " name"
78+ }
7979 }
8080}
Original file line number Diff line number Diff line change @@ -367,40 +367,40 @@ class SchemaParserSpec extends Specification {
367367 noExceptionThrown()
368368 }
369369
370- }
371-
372- enum EnumType { TEST }
370+ enum EnumType { TEST }
373371
374- class QueryWithIdResolver implements GraphQLQueryResolver {
375- String getId () { null }
376- }
372+ class QueryWithIdResolver implements GraphQLQueryResolver {
373+ String getId () { null }
374+ }
377375
378- class Filter {
379- String filter () { null }
380- }
376+ class Filter {
377+ String filter () { null }
378+ }
381379
382- class CustomGenericWrapper <T, V> {}
380+ class CustomGenericWrapper <T, V> {}
383381
384- class Obj {
385- def name () { null }
386- }
382+ class Obj {
383+ def name () { null }
384+ }
387385
388- class AnotherObj {
389- def key () { null }
390- }
386+ class AnotherObj {
387+ def key () { null }
388+ }
391389
392- class RootObj {
393- }
390+ class RootObj {
391+ }
394392
395- class ProxiedResolver implements GraphQLQueryResolver {
396- List<String > test () { [] }
397- }
393+ class ProxiedResolver implements GraphQLQueryResolver {
394+ List<String > test () { [] }
395+ }
398396
399- enum CustomEnum {
400- FOO {
401- @Override
402- String toString() {
403- return " Bar"
397+ enum CustomEnum {
398+ FOO {
399+ @Override
400+ String toString() {
401+ return " Bar"
402+ }
404403 }
405404 }
405+
406406}
Original file line number Diff line number Diff line change 1+ package com.coxautodev.graphql.tools
2+
3+
4+ import spock.lang.Specification
5+
6+ class SuperclassResolverSpec extends Specification {
7+
8+ def " methods from generic resolvers are resolved" () {
9+ when :
10+ SchemaParser . newParser(). schemaString(''' \
11+ type Query {
12+ bar: Bar!
13+ }
14+
15+ type Bar {
16+ value: String
17+ }
18+ ''' )
19+ .resolvers(new QueryResolver (), new BarResolver ())
20+ .build()
21+ .makeExecutableSchema()
22+
23+ then :
24+ noExceptionThrown()
25+ }
26+
27+ class QueryResolver implements GraphQLQueryResolver {
28+ Bar getBar () {
29+ return new Bar ()
30+ }
31+ }
32+
33+ class Bar {
34+ }
35+
36+ abstract class FooResolver <T> implements GraphQLResolver<Bar > {
37+ String getValue (T foo ) {
38+ return " value"
39+ }
40+ }
41+
42+ class BarResolver extends FooResolver<Bar > {
43+
44+ }
45+ }
You can’t perform that action at this time.
0 commit comments