File tree Expand file tree Collapse file tree 3 files changed +0
-52
lines changed
main/java/org/springframework/graphql/test/query
test/java/org/springframework/graphql/test/query Expand file tree Collapse file tree 3 files changed +0
-52
lines changed Original file line number Diff line number Diff line change @@ -98,30 +98,6 @@ public QuerySpec query(String query) {
98
98
return new DefaultQuerySpec (query );
99
99
}
100
100
101
- @ Override
102
- public ExecuteSpec requestBody (String jsonBody ) {
103
- return new ExecuteSpec () {
104
-
105
- @ Override
106
- public ResponseSpec execute () {
107
- RequestInput input = toRequestInput (jsonBody );
108
- return DefaultGraphQLTester .this .requestStrategy .execute (input );
109
- }
110
-
111
- @ Override
112
- public SubscriptionSpec executeSubscription () {
113
- RequestInput input = toRequestInput (jsonBody );
114
- return DefaultGraphQLTester .this .requestStrategy .executeSubscription (input );
115
- }
116
-
117
- private RequestInput toRequestInput (String jsonBody ) {
118
- DocumentContext context = JsonPath .parse (jsonBody , DefaultGraphQLTester .this .jsonPathConfig );
119
- Map <String , Object > map = context .read ("$" );
120
- return new RequestInput (map );
121
- }
122
- };
123
- }
124
-
125
101
126
102
/**
127
103
* Encapsulate how a GraphQL request is performed.
Original file line number Diff line number Diff line change @@ -99,15 +99,6 @@ public interface GraphQLTester {
99
99
*/
100
100
QuerySpec query (String query );
101
101
102
- /**
103
- * Prepare to perform a GraphQL request with the given serialized HTTP request body.
104
- * @param jsonBody the full request body serialized to JSON
105
- * @return spec for response assertions
106
- * @throws AssertionError if the response status is not 200 (OK)
107
- * @see <a href="https://github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md">GraphQL over HTTP</a>
108
- */
109
- ExecuteSpec requestBody (String jsonBody );
110
-
111
102
112
103
/**
113
104
* Create a {@code GraphQLTester} that performs GraphQL requests as an HTTP
Original file line number Diff line number Diff line change 40
40
import reactor .core .publisher .Mono ;
41
41
42
42
import org .springframework .core .ParameterizedTypeReference ;
43
- import org .springframework .graphql .RequestInput ;
44
43
import org .springframework .graphql .WebGraphQLService ;
45
44
import org .springframework .graphql .WebInput ;
46
45
import org .springframework .graphql .WebOutput ;
@@ -214,24 +213,6 @@ void operationNameAndVariables(GraphQLTesterSetup setup) throws Exception {
214
213
setup .shutdown ();
215
214
}
216
215
217
- @ ParameterizedTest
218
- @ MethodSource ("argumentSource" )
219
- void requestBody (GraphQLTesterSetup setup ) throws Exception {
220
-
221
- String query = "{me {name}}" ;
222
- setup .response ("{\" me\" : {\" name\" :\" Luke Skywalker\" }}" );
223
-
224
- RequestInput requestInput = new RequestInput (query , null , null );
225
- String jsonBody = OBJECT_MAPPER .writeValueAsString (requestInput );
226
-
227
- GraphQLTester .ResponseSpec spec = setup .graphQLTester ().requestBody (jsonBody ).execute ();
228
-
229
- spec .path ("me" ).entity (MovieCharacter .class ).isEqualTo (MovieCharacter .create ("Luke Skywalker" ));
230
-
231
- setup .verifyRequest (webInput -> assertThat (webInput .getQuery ()).isEqualTo (query ));
232
- setup .shutdown ();
233
- }
234
-
235
216
@ ParameterizedTest
236
217
@ MethodSource ("argumentSource" )
237
218
void errorsAssertedIfNotChecked (GraphQLTesterSetup setup ) throws Exception {
You can’t perform that action at this time.
0 commit comments