@@ -88,6 +88,14 @@ public Stream<Obj> getObjStream() {
8888 Obj [] a = new Obj [objs .size ()];
8989 return Stream .of (objs .toArray (a ));
9090 }
91+
92+ @ GraphQLField
93+ @ GraphQLConnection (name = "objStreamWithParam" )
94+ public Stream <Obj > getObjStreamWithParam (@ GraphQLName ("filter" ) String filter ) {
95+ return this .objs .stream ().filter ( obj -> obj .val .startsWith (filter ));
96+ }
97+
98+
9199 }
92100
93101 @ Test
@@ -128,6 +136,27 @@ public void methodStream() {
128136 testResult ("objStream" , result );
129137 }
130138
139+ @ Test
140+ public void methodListWithParam () {
141+ GraphQLObjectType object = GraphQLAnnotations .object (TestConnections .class );
142+ GraphQLSchema schema = newSchema ().query (object ).build ();
143+
144+ GraphQL graphQL = GraphQL .newGraphQL (schema ).build ();
145+ ExecutionResult result = graphQL .execute ("{ objStreamWithParam(first: 2, filter:\" hel\" ) { edges { cursor node { id, val } } } }" ,
146+ new TestConnections (Arrays .asList (new Obj ("1" , "test" ), new Obj ("2" , "hello" ), new Obj ("3" , "world" ), new Obj ("4" , "hello world" ), new Obj ("5" , "hello again" ))));
147+
148+ assertTrue (result .getErrors ().isEmpty ());
149+
150+ Map <String , Map <String , List <Map <String , Map <String , Object >>>>> data = result .getData ();
151+ List <Map <String , Map <String , Object >>> edges = data .get ("objStreamWithParam" ).get ("edges" );
152+
153+ assertEquals (edges .size (), 2 );
154+ assertEquals (edges .get (0 ).get ("node" ).get ("id" ), "2" );
155+ assertEquals (edges .get (0 ).get ("node" ).get ("val" ), "hello" );
156+ assertEquals (edges .get (1 ).get ("node" ).get ("id" ), "4" );
157+ assertEquals (edges .get (1 ).get ("node" ).get ("val" ), "hello world" );
158+ }
159+
131160
132161 public static class CustomConnection implements Connection {
133162
0 commit comments