11/**
22 * Copyright 2016 Yurii Rashkovskii
3- *
3+ * <p>
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
66 * You may obtain a copy of the License at
7- *
8- * http://www.apache.org/licenses/LICENSE-2.0
9- *
7+ * <p>
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ * <p>
1010 * Unless required by applicable law or agreed to in writing, software
1111 * distributed under the License is distributed on an "AS IS" BASIS,
1212 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2828import java .util .Map ;
2929
3030import static graphql .Scalars .GraphQLString ;
31- import static graphql .schema . GraphQLSchema . newSchema ;
31+ import static graphql .annotations . AnnotationsSchemaCreator . newAnnotationsSchema ;
3232import static org .testng .Assert .*;
3333
3434public class GraphQLExtensionsTest {
@@ -114,13 +114,7 @@ public void fields() {
114114
115115 @ Test
116116 public void values () {
117- GraphQLAnnotations instance = new GraphQLAnnotations ();
118- instance .registerTypeExtension (TestObjectExtension .class );
119- GraphQLObjectHandler graphQLObjectHandler = instance .getObjectHandler ();
120- GraphQLObjectType object = graphQLObjectHandler .getGraphQLType (GraphQLExtensionsTest .TestObject .class , instance .getContainer ());
121-
122- GraphQLSchema schema = newSchema ().query (object ).build ();
123- GraphQLSchema schemaInherited = newSchema ().query (object ).build ();
117+ GraphQLSchema schema = newAnnotationsSchema ().query (TestObject .class ).typeExtension (TestObjectExtension .class ).build ();
124118
125119 ExecutionResult result = GraphQL .newGraphQL (schema ).build ().execute ("{field field2 field3 field4 field5}" , new GraphQLExtensionsTest .TestObject ());
126120 Map <String , Object > data = result .getData ();
@@ -136,7 +130,7 @@ public void testDuplicateField() {
136130 GraphQLAnnotations instance = new GraphQLAnnotations ();
137131 GraphQLObjectHandler graphQLObjectHandler = instance .getObjectHandler ();
138132 instance .registerTypeExtension (TestObjectExtensionInvalid .class );
139- GraphQLAnnotationsException e = expectThrows (GraphQLAnnotationsException .class , () -> graphQLObjectHandler .getGraphQLType (TestObject .class ,instance .getContainer ()));
133+ GraphQLAnnotationsException e = expectThrows (GraphQLAnnotationsException .class , () -> graphQLObjectHandler .getGraphQLType (TestObject .class , instance .getContainer ()));
140134 assertTrue (e .getMessage ().startsWith ("Duplicate field" ));
141135 }
142136}
0 commit comments