Skip to content

Commit 0e394d4

Browse files
committed
Update RelayConnectionTest with generics #114
1 parent e093b87 commit 0e394d4

File tree

1 file changed

+4
-32
lines changed

1 file changed

+4
-32
lines changed

src/test/java/com/coxautodev/graphql/tools/RelayConnectionTest.java

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package com.coxautodev.graphql.tools;
22

3-
import graphql.relay.*;
3+
import graphql.relay.Connection;
4+
import graphql.relay.SimpleListConnection;
45
import graphql.schema.DataFetchingEnvironment;
56
import org.junit.Test;
67

78
import java.util.ArrayList;
8-
import java.util.List;
9-
import java.util.stream.Collectors;
109

1110
public 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

Comments
 (0)