@@ -96,6 +96,63 @@ public void build_Mutation_SchemaIsCreatedWithMutation() {
9696 assertThat (mutationType .getFieldDefinitions ().size (), is (1 ));
9797 }
9898
99+ public interface BaseQuery {
100+ @ GraphQLField
101+ int baseQuery ();
102+ }
103+
104+ public interface IntermediateQuery extends BaseQuery {
105+ @ GraphQLField
106+ int intermediateQuery ();
107+ }
108+
109+ public interface InheritedQuery extends IntermediateQuery {
110+ @ GraphQLField
111+ int inheritedQuery ();
112+ }
113+
114+ public interface BaseMutation {
115+ @ GraphQLField
116+ int baseMutation ();
117+ }
118+
119+ public static class ParentMutation implements BaseMutation {
120+ @ Override
121+ public int baseMutation () {
122+ return 6 ;
123+ }
124+
125+ @ GraphQLField
126+ public int parentMutation () {
127+ return 7 ;
128+ }
129+ }
130+
131+ public static class InheritedMutation extends ParentMutation {
132+ @ GraphQLField
133+ public int inheritedMutation () {
134+ return 8 ;
135+ }
136+ }
137+
138+ @ Test
139+ public void build_QueryAndMutationWithInheritedTypes_SchemaContainsInheritedFields () {
140+ // arrange + act
141+ GraphQLSchema schema = builder .query (InheritedQuery .class ).mutation (InheritedMutation .class ).build ();
142+ GraphQLObjectType queryType = schema .getQueryType ();
143+ GraphQLObjectType mutationType = schema .getMutationType ();
144+
145+ // assert
146+ assertThat (queryType .getFieldDefinition ("baseQuery" ), notNullValue ());
147+ assertThat (queryType .getFieldDefinition ("intermediateQuery" ), notNullValue ());
148+ assertThat (queryType .getFieldDefinition ("inheritedQuery" ), notNullValue ());
149+ assertThat (queryType .getFieldDefinitions ().size (), is (3 ));
150+ assertThat (mutationType .getFieldDefinition ("baseMutation" ), notNullValue ());
151+ assertThat (mutationType .getFieldDefinition ("parentMutation" ), notNullValue ());
152+ assertThat (mutationType .getFieldDefinition ("inheritedMutation" ), notNullValue ());
153+ assertThat (mutationType .getFieldDefinitions ().size (), is (3 ));
154+ }
155+
99156 public static class SubscriptionTest {
100157 @ GraphQLField
101158 public int subscribe () {
0 commit comments