|
36 | 36 |
|
37 | 37 | import static graphql.annotations.processor.util.RelayKit.EMPTY_CONNECTION; |
38 | 38 | import static graphql.schema.GraphQLSchema.newSchema; |
| 39 | +import static java.util.Collections.emptyList; |
39 | 40 | import static org.testng.Assert.assertEquals; |
40 | 41 | import static org.testng.Assert.assertTrue; |
41 | 42 | import static org.testng.Assert.fail; |
@@ -308,6 +309,22 @@ public void methodNull() { |
308 | 309 | assertEquals(data.get("nullObj").get("edges").size(), 0); |
309 | 310 | } |
310 | 311 |
|
| 312 | + @Test |
| 313 | + public void emptyListData() { |
| 314 | + GraphQLObjectType object = GraphQLAnnotations.object(TestConnections.class); |
| 315 | + GraphQLSchema schema = newSchema().query(object).build(); |
| 316 | + |
| 317 | + GraphQL graphQL = GraphQL.newGraphQL(schema).build(); |
| 318 | + ExecutionResult result = graphQL.execute("{ objStreamWithParam(first: 1, filter:\"hel\") { edges { cursor node { id, val } } } }", |
| 319 | + new TestConnections(emptyList())); |
| 320 | + assertTrue(result.getErrors().isEmpty()); |
| 321 | + |
| 322 | + Map<String, Map<String, List<Map<String, Map<String, Object>>>>> data = result.getData(); |
| 323 | + List<Map<String, Map<String, Object>>> edges = data.get("objStreamWithParam").get("edges"); |
| 324 | + |
| 325 | + assertEquals(edges.size(), 0); |
| 326 | + } |
| 327 | + |
311 | 328 | @Test |
312 | 329 | public void methodListWithParam() { |
313 | 330 | GraphQLObjectType object = GraphQLAnnotations.object(TestConnections.class); |
|
0 commit comments