1818import reactor .core .publisher .Mono ;
1919import testconfig .TestAppConfig ;
2020
21- import java .net .URLEncoder ;
2221import java .util .LinkedHashMap ;
2322import java .util .Map ;
2423import java .util .concurrent .CompletableFuture ;
@@ -109,9 +108,7 @@ public void testSimplePostRequest() throws Exception {
109108 @ Test
110109 public void testQueryParamPostRequest () throws Exception {
111110 String variablesJson = "{\" variable\" :\" variableValue\" }" ;
112- String variablesValue = URLEncoder .encode (variablesJson , "UTF-8" );
113111 String query = "query myQuery {foo}" ;
114- String queryString = URLEncoder .encode (query , "UTF-8" );
115112 String operationName = "myQuery" ;
116113
117114 ExecutionResultImpl executionResult = ExecutionResultImpl .newExecutionResult ()
@@ -122,10 +119,10 @@ public void testQueryParamPostRequest() throws Exception {
122119 Mockito .when (graphql .executeAsync (captor .capture ())).thenReturn (cf );
123120
124121 client .post ().uri (uriBuilder -> uriBuilder .path ("/graphql" )
125- .queryParam ("variables" , variablesValue )
126- .queryParam ("query" , queryString )
127- .queryParam ("operationName" , operationName )
128- .build (variablesJson , queryString ))
122+ .queryParam ("variables" , "{variables}" )
123+ .queryParam ("query" , "{query}" )
124+ .queryParam ("operationName" , "{ operationName}" )
125+ .build (variablesJson , query , operationName ))
129126 .accept (MediaType .APPLICATION_JSON_UTF8 )
130127 .exchange ()
131128 .expectStatus ().isOk ()
@@ -144,7 +141,6 @@ public void testQueryParamPostRequest() throws Exception {
144141 @ Test
145142 public void testSimpleQueryParamPostRequest () throws Exception {
146143 String query = "{foo}" ;
147- String queryString = URLEncoder .encode (query , "UTF-8" );
148144
149145 ExecutionResultImpl executionResult = ExecutionResultImpl .newExecutionResult ()
150146 .data ("bar" )
@@ -154,8 +150,8 @@ public void testSimpleQueryParamPostRequest() throws Exception {
154150 Mockito .when (graphql .executeAsync (captor .capture ())).thenReturn (cf );
155151
156152 client .post ().uri (uriBuilder -> uriBuilder .path ("/graphql" )
157- .queryParam ("query" , queryString )
158- .build ())
153+ .queryParam ("query" , "{query}" )
154+ .build (query ))
159155 .accept (MediaType .APPLICATION_JSON_UTF8 )
160156 .exchange ()
161157 .expectStatus ().isOk ()
@@ -196,9 +192,7 @@ public void testApplicationGraphqlPostRequest() throws Exception {
196192 @ Test
197193 public void testGetRequest () throws Exception {
198194 String variablesJson = "{\" variable\" :\" variableValue\" }" ;
199- String variablesValue = URLEncoder .encode (variablesJson , "UTF-8" );
200195 String query = "query myQuery {foo}" ;
201- String queryString = URLEncoder .encode (query , "UTF-8" );
202196 String operationName = "myQuery" ;
203197
204198 ExecutionResultImpl executionResult = ExecutionResultImpl .newExecutionResult ()
@@ -209,10 +203,10 @@ public void testGetRequest() throws Exception {
209203 Mockito .when (graphql .executeAsync (captor .capture ())).thenReturn (cf );
210204
211205 client .get ().uri (uriBuilder -> uriBuilder .path ("/graphql" )
212- .queryParam ("variables" , variablesValue )
213- .queryParam ("query" , queryString )
214- .queryParam ("operationName" , operationName )
215- .build (variablesJson , queryString ))
206+ .queryParam ("variables" , "{variables}" )
207+ .queryParam ("query" , "{query}" )
208+ .queryParam ("operationName" , "{ operationName}" )
209+ .build (variablesJson , query , operationName ))
216210 .accept (MediaType .APPLICATION_JSON_UTF8 )
217211 .exchange ()
218212 .expectStatus ().isOk ()
@@ -231,7 +225,6 @@ public void testGetRequest() throws Exception {
231225 @ Test
232226 public void testSimpleGetRequest () throws Exception {
233227 String query = "{foo}" ;
234- String queryString = URLEncoder .encode (query , "UTF-8" );
235228
236229 ExecutionResultImpl executionResult = ExecutionResultImpl .newExecutionResult ()
237230 .data ("bar" )
@@ -241,8 +234,8 @@ public void testSimpleGetRequest() throws Exception {
241234 Mockito .when (graphql .executeAsync (captor .capture ())).thenReturn (cf );
242235
243236 client .get ().uri (uriBuilder -> uriBuilder .path ("/graphql" )
244- .queryParam ("query" , queryString )
245- .build ())
237+ .queryParam ("query" , "{query}" )
238+ .build (query ))
246239 .accept (MediaType .APPLICATION_JSON_UTF8 )
247240 .exchange ()
248241 .expectStatus ().isOk ()
0 commit comments