31
31
import com .jayway .jsonpath .DocumentContext ;
32
32
import com .jayway .jsonpath .JsonPath ;
33
33
import com .jayway .jsonpath .TypeRef ;
34
- import graphql .ExecutionResult ;
35
34
import graphql .GraphQLError ;
36
35
37
36
import org .springframework .core .ParameterizedTypeReference ;
38
37
import org .springframework .core .ResolvableType ;
39
38
import org .springframework .graphql .GraphQlRequest ;
39
+ import org .springframework .graphql .GraphQlResponse ;
40
40
import org .springframework .graphql .client .GraphQlTransport ;
41
41
import org .springframework .graphql .support .DocumentSource ;
42
42
import org .springframework .lang .Nullable ;
@@ -165,7 +165,7 @@ public DefaultRequest variable(String name, @Nullable Object value) {
165
165
@ SuppressWarnings ("ConstantConditions" )
166
166
@ Override
167
167
public Response execute () {
168
- return transport .execute (request ()).map (result -> response ( result , request ())).block (responseTimeout );
168
+ return transport .execute (request ()).map (response -> mapResponse ( response , request ())).block (responseTimeout );
169
169
}
170
170
171
171
@ Override
@@ -175,15 +175,15 @@ public void executeAndVerify() {
175
175
176
176
@ Override
177
177
public Subscription executeSubscription () {
178
- return () -> transport .executeSubscription (request ()).map (result -> response (result , request ()));
178
+ return () -> transport .executeSubscription (request ()).map (result -> mapResponse (result , request ()));
179
179
}
180
180
181
181
private GraphQlRequest request () {
182
182
return new GraphQlRequest (this .document , this .operationName , this .variables );
183
183
}
184
184
185
- private DefaultResponse response ( ExecutionResult result , GraphQlRequest request ) {
186
- return new DefaultResponse (result , errorFilter , assertDecorator (request ), jsonPathConfig );
185
+ private DefaultResponse mapResponse ( GraphQlResponse response , GraphQlRequest request ) {
186
+ return new DefaultResponse (response , errorFilter , assertDecorator (request ), jsonPathConfig );
187
187
}
188
188
189
189
private Consumer <Runnable > assertDecorator (GraphQlRequest request ) {
@@ -217,12 +217,12 @@ private final static class ResponseDelegate {
217
217
218
218
219
219
private ResponseDelegate (
220
- ExecutionResult result , @ Nullable Predicate <GraphQLError > errorFilter ,
220
+ GraphQlResponse response , @ Nullable Predicate <GraphQLError > errorFilter ,
221
221
Consumer <Runnable > assertDecorator , Configuration jsonPathConfig ) {
222
222
223
- this .jsonDoc = JsonPath .parse (result . toSpecification (), jsonPathConfig );
223
+ this .jsonDoc = JsonPath .parse (response . toMap (), jsonPathConfig );
224
224
this .jsonContent = this .jsonDoc ::jsonString ;
225
- this .errors = result .getErrors ();
225
+ this .errors = response .getErrors ();
226
226
this .unexpectedErrors = new ArrayList <>(this .errors );
227
227
this .assertDecorator = assertDecorator ;
228
228
@@ -293,10 +293,10 @@ private static final class DefaultResponse implements Response, Errors {
293
293
private final ResponseDelegate delegate ;
294
294
295
295
private DefaultResponse (
296
- ExecutionResult result , @ Nullable Predicate <GraphQLError > errorFilter ,
296
+ GraphQlResponse response , @ Nullable Predicate <GraphQLError > errorFilter ,
297
297
Consumer <Runnable > assertDecorator , Configuration jsonPathConfig ) {
298
298
299
- this .delegate = new ResponseDelegate (result , errorFilter , assertDecorator , jsonPathConfig );
299
+ this .delegate = new ResponseDelegate (response , errorFilter , assertDecorator , jsonPathConfig );
300
300
}
301
301
302
302
@ Override
0 commit comments