1616
1717import java .io .IOException ;
1818import java .io .InputStream ;
19-
2019import java .nio .charset .StandardCharsets ;
2120import java .util .List ;
2221
2322public class GraphQLTestTemplate {
2423
25- @ Autowired private ResourceLoader resourceLoader ;
26- @ Autowired (required = false ) private TestRestTemplate restTemplate ;
27- @ Value ("${graphql.servlet.mapping:/graphql}" ) private String graphqlMapping ;
24+ @ Autowired
25+ private ResourceLoader resourceLoader ;
26+ @ Autowired (required = false )
27+ private TestRestTemplate restTemplate ;
28+ @ Value ("${graphql.servlet.mapping:/graphql}" )
29+ private String graphqlMapping ;
2830
2931 private ObjectMapper objectMapper = new ObjectMapper ();
3032 private HttpHeaders headers = new HttpHeaders ();
3133
32- private String createJsonQuery (String graphql , ObjectNode variables ) throws JsonProcessingException {
34+ private String createJsonQuery (String graphql , ObjectNode variables )
35+ throws JsonProcessingException {
3336
3437 ObjectNode wrapper = objectMapper .createObjectNode ();
3538 wrapper .put ("query" , graphql );
@@ -51,7 +54,7 @@ private String loadResource(Resource resource) throws IOException {
5154 /**
5255 * Add an HTTP header that will be sent with each request this sends.
5356 *
54- * @param name Name (key) of HTTP header to add.
57+ * @param name Name (key) of HTTP header to add.
5558 * @param value Value of HTTP header to add.
5659 */
5760 public void addHeader (String name , String value ) {
@@ -75,10 +78,11 @@ public void clearHeaders() {
7578 }
7679
7780 /**
81+ * @deprecated Use {@link #postForResource(String)} instead
82+ *
7883 * @param graphqlResource path to the classpath resource containing the GraphQL query
7984 * @return GraphQLResponse containing the result of query execution
8085 * @throws IOException if the resource cannot be loaded from the classpath
81- * @deprecated Use {@link #postForResource(String)} instead
8286 */
8387 public GraphQLResponse perform (String graphqlResource ) throws IOException {
8488 return postForResource (graphqlResource );
0 commit comments