7
7
8
8
import java .util .List ;
9
9
10
+ import javax .net .ssl .HostnameVerifier ;
11
+ import javax .net .ssl .SSLContext ;
12
+
10
13
import org .graphql .maven .plugin .samples .simple .client .Main ;
11
14
import org .graphql .maven .plugin .samples .simple .client .Queries ;
12
15
import org .junit .jupiter .api .Test ;
21
24
import graphql .java .client .response .GraphQLRequestPreparationException ;
22
25
23
26
/**
24
- * As it is suffixed by "IT", this is an integration test. Thus, it allows us to start the GraphQL StatWars server, see
25
- * the pom.xml file for details.
27
+ * As it is suffixed by "IT", this is an integration test. Thus, it allows us to
28
+ * start the GraphQL StatWars server, see the pom.xml file for details.
26
29
*
27
30
* @author EtienneSF
28
31
*/
29
32
abstract class AbstractIT {
30
33
31
- QueryType queryType = new QueryType ( Main . graphqlEndpoint ) ;
34
+ QueryType queryType ;
32
35
Queries queries ;
33
36
34
37
@ Test
@@ -49,7 +52,8 @@ void test_heroPartial() throws GraphQLExecutionException, GraphQLRequestPreparat
49
52
50
53
@ Test
51
54
void test_heroFriendsFriendsFriends () throws GraphQLExecutionException , GraphQLRequestPreparationException {
52
- // return queryType.hero("{id appearsIn friends {name friends {friends{id name appearsIn}}}}", Episode.NEWHOPE);
55
+ // return queryType.hero("{id appearsIn friends {name friends {friends{id name
56
+ // appearsIn}}}}", Episode.NEWHOPE);
53
57
Character c = queries .heroFriendsFriendsFriends ();
54
58
55
59
checkCharacter (c , "testHeroFriendsFriendsFriends" , "00000000-0000-0000-0000-000000000002" , null , 2 ,
@@ -104,7 +108,8 @@ void test_humanPartial() throws GraphQLExecutionException, GraphQLRequestPrepara
104
108
105
109
@ Test
106
110
void test_humanFriendsFriendsFriends () throws GraphQLExecutionException , GraphQLRequestPreparationException {
107
- // queryType.human("{id appearsIn name friends {name friends {friends{id name appearsIn}}}}", "180");
111
+ // queryType.human("{id appearsIn name friends {name friends {friends{id name
112
+ // appearsIn}}}}", "180");
108
113
Human h = queries .humanFriendsFriendsFriends ();
109
114
110
115
checkCharacter (h , "testHeroFriendsFriendsFriends[friends_1]" , "00000000-0000-0000-0000-000000000180" ,
@@ -150,7 +155,8 @@ void test_droidSimple() throws GraphQLExecutionException, GraphQLRequestPreparat
150
155
151
156
@ Test
152
157
void test_droidFriendsFriendsFriends () throws GraphQLExecutionException , GraphQLRequestPreparationException {
153
- // droid("{id appearsIn name friends {name friends {friends{id name appearsIn}}} primaryFunction }", "2");
158
+ // droid("{id appearsIn name friends {name friends {friends{id name appearsIn}}}
159
+ // primaryFunction }", "2");
154
160
Droid d = queries .droidFriendsFriendsFriends ();
155
161
156
162
checkCharacter (d , "testDroidFriendsFriendsFriends" , "00000000-0000-0000-0000-000000000002" , "BB-8" , 2 ,
@@ -203,8 +209,15 @@ void test_addFriend() throws GraphQLExecutionException, GraphQLRequestPreparatio
203
209
204
210
// Verification
205
211
assertEquals (characterBefore .getFriends ().size () + 1 , characterAfter .getFriends ().size ());
206
- // The new friend should be at the end of the list
207
- assertEquals (friend .getId (), characterAfter .getFriends ().get (characterAfter .getFriends ().size () - 1 ).getId ());
212
+ // The new friend should be somewhere in the list
213
+ boolean found = false ;
214
+ for (Character c : characterAfter .getFriends ()) {
215
+ if (c .getId ().equals (friend .getId ())) {
216
+ found = true ;
217
+ break ;
218
+ }
219
+ }
220
+ assertTrue (found , "We should have found the new friend" );
208
221
}
209
222
210
223
private void checkCharacter (Character c , String testDecription , String id , String name , int nbFriends ,
0 commit comments