2323import graphql .annotations .processor .GraphQLAnnotations ;
2424import graphql .schema .DataFetcher ;
2525import graphql .schema .DataFetchingEnvironment ;
26- import graphql .schema .GraphQLObjectType ;
2726import graphql .schema .GraphQLSchema ;
28- import org .testng .annotations .BeforeClass ;
27+ import org .testng .annotations .BeforeMethod ;
2928import org .testng .annotations .Test ;
3029
31- import java .util .Arrays ;
32- import java .util .Collections ;
33- import java .util .List ;
34- import java .util .Map ;
30+ import java .util .*;
3531
36- import static graphql .schema . GraphQLSchema . newSchema ;
32+ import static graphql .annotations . AnnotationsSchemaCreator . newAnnotationsSchema ;
3733import static org .testng .Assert .assertEquals ;
3834
3935@ SuppressWarnings ("ALL" )
4036public class GraphQLEnhancedConnectionTest {
4137
42- private static GraphQL graphQL ;
38+ private GraphQL graphQL ;
4339 private GraphQLAnnotations graphQLAnnotations ;
4440
4541
46- @ BeforeClass
42+ @ BeforeMethod
4743 public void setUp () throws Exception {
4844 this .graphQLAnnotations = new GraphQLAnnotations ();
49- GraphQLObjectType object = this .graphQLAnnotations .object (TestListField .class );
50- GraphQLSchema schema = newSchema ().query (object ).build ();
51-
45+ GraphQLSchema schema = newAnnotationsSchema ().query (TestListField .class ).build ();
5246 graphQL = GraphQL .newGraphQL (schema ).build ();
5347 }
5448
@@ -156,7 +150,7 @@ public void validDatafetcher_queryForCursors_getValidCursors() throws Exception
156150 public void fetchConnectionAsync () throws Exception {
157151 //Arrange
158152 ExecutionInput executionInput = new ExecutionInput ("{ objsAsync(first:2) { edges { cursor } } }" ,
159- null , "CONTEXT" , null , null );
153+ null , "CONTEXT" , null , new HashMap <>() );
160154 //Act
161155 ExecutionResult result = graphQL .execute (executionInput );
162156 Map <String , Map <String , List <Map <String , Map <String , Object >>>>> data = result .getData ();
@@ -171,7 +165,7 @@ public void fetchConnectionAsync() throws Exception {
171165 public void validDatafetcher_queryForValues_returnsValidValues () throws Exception {
172166 //Arrange
173167 ExecutionInput executionInput = new ExecutionInput ("{ objs(first:2) { edges { cursor node { id, val } } } }" ,
174- null , "CONTEXT" , null , null );
168+ null , "CONTEXT" , null , new HashMap <>() );
175169
176170 //Act
177171 ExecutionResult result = graphQL .execute (executionInput );
@@ -188,7 +182,7 @@ public void validDatafetcher_queryForHasPreviousPage_returnsFalse() throws Excep
188182
189183 //Arrange
190184 ExecutionInput executionInput = new ExecutionInput ("{ objs(first:2) { pageInfo { hasPreviousPage } } }" ,
191- null , "CONTEXT" , null , null );
185+ null , "CONTEXT" , null , new HashMap <>() );
192186
193187 //Act
194188 ExecutionResult result = graphQL .execute (executionInput );
@@ -203,7 +197,7 @@ public void validDatafetcher_queryForHasNextPage_returnsTrue() throws Exception
203197
204198 //Arrange
205199 ExecutionInput executionInput = new ExecutionInput ("{ objs(first:2) { pageInfo { hasNextPage } } }" ,
206- null , "CONTEXT" , null , null );
200+ null , "CONTEXT" , null , new HashMap <>() );
207201
208202 //Act
209203 ExecutionResult result = graphQL .execute (executionInput );
0 commit comments