11package com .coxautodev .graphql .tools ;
22
3- import graphql .relay .*;
3+ import graphql .relay .Connection ;
4+ import graphql .relay .SimpleListConnection ;
45import graphql .schema .DataFetchingEnvironment ;
56import org .junit .Test ;
67
78import java .util .ArrayList ;
8- import java .util .List ;
9- import java .util .stream .Collectors ;
109
1110public class RelayConnectionTest {
1211
@@ -21,38 +20,11 @@ public void compiles() {
2120
2221 static class QueryResolver implements GraphQLQueryResolver {
2322 // fixme #114: desired return type to use: Connection<User>
24- public UserConnection users (int first , String after , DataFetchingEnvironment env ) {
25- return ( UserConnection ) new SimpleListConnection <User >(new ArrayList ()).get (env );
23+ public Connection < User > users (int first , String after , DataFetchingEnvironment env ) {
24+ return new SimpleListConnection <User >(new ArrayList <> ()).get (env );
2625 }
2726 }
2827
29- // fixme #114: remove this implementation
30- static class UserConnection extends DefaultConnection <User > {
31-
32- UserConnection (List <Edge <User >> edges , PageInfo pageInfo ) {
33- super (edges , pageInfo );
34- }
35-
36- public List <UserEdge > edges () {
37- return super .getEdges ().stream ()
38- .map (UserEdge .class ::cast )
39- .collect (Collectors .toList ());
40- }
41-
42- public PageInfo getPageInfo () {
43- return super .getPageInfo ();
44- }
45- }
46-
47- // fixme #114: remove this implementation
48- static class UserEdge extends DefaultEdge <User > {
49-
50- UserEdge (User node , ConnectionCursor cursor ) {
51- super (node , cursor );
52- }
53-
54- }
55-
5628 static class User {
5729 Long id ;
5830 String name ;
0 commit comments