2323import graphql .annotations .processor .GraphQLAnnotations ;
2424import graphql .schema .DataFetcher ;
2525import graphql .schema .DataFetchingEnvironment ;
26- import graphql .schema .GraphQLObjectType ;
2726import graphql .schema .GraphQLSchema ;
2827import org .testng .annotations .BeforeMethod ;
2928import org .testng .annotations .Test ;
3231import java .util .HashMap ;
3332import java .util .List ;
3433
35- import static graphql .schema . GraphQLSchema . newSchema ;
34+ import static graphql .annotations . AnnotationsSchemaCreator . newAnnotationsSchema ;
3635import static org .hamcrest .CoreMatchers .is ;
3736import static org .hamcrest .MatcherAssert .assertThat ;
3837import static org .testng .Assert .assertEquals ;
@@ -49,8 +48,7 @@ public void init() {
4948
5049 @ Test
5150 public void simpleConnection_buildSchema_TypeOfSimpleConnectionIsGraphQLList () throws Exception {
52- GraphQLObjectType object = this .graphQLAnnotations .object (MainConnection .class );
53- GraphQLSchema schema = newSchema ().query (object ).build ();
51+ GraphQLSchema schema = newAnnotationsSchema ().query (MainConnection .class ).build ();
5452
5553 String objsTypeName = schema .getQueryType ().getFieldDefinition ("objs" ).getType ().getName ();
5654
@@ -69,8 +67,7 @@ public void simpleConnection_returnTypeIsNotValid_throwsError() {
6967
7068 @ Test
7169 public void simpleConnection_queryForOverAll_getCorrectAnswer () {
72- GraphQLObjectType object = this .graphQLAnnotations .object (MainConnection .class );
73- GraphQLSchema schema = newSchema ().query (object ).build ();
70+ GraphQLSchema schema = newAnnotationsSchema ().query (MainConnection .class ).build ();
7471 GraphQL graphQL = GraphQL .newGraphQL (schema ).build ();
7572
7673
@@ -83,8 +80,7 @@ public void simpleConnection_queryForOverAll_getCorrectAnswer() {
8380
8481 @ Test
8582 public void simpleConnection_queryForTwoObject_getTwoObject () {
86- GraphQLObjectType object = this .graphQLAnnotations .object (MainConnection .class );
87- GraphQLSchema schema = newSchema ().query (object ).build ();
83+ GraphQLSchema schema = newAnnotationsSchema ().query (MainConnection .class ).build ();
8884 GraphQL graphQL = GraphQL .newGraphQL (schema ).build ();
8985
9086
0 commit comments