Interface GraphQlTester

All Known Subinterfaces:
ExecutionGraphQlServiceTester, HttpGraphQlTester, RSocketGraphQlTester, WebGraphQlTester, WebSocketGraphQlTester
All Known Implementing Classes:
AbstractDelegatingGraphQlTester

public interface GraphQlTester
Define a workflow to test GraphQL requests that is independent of the underlying transport.

To test using a client that connects to a server, with or without a live server, see GraphQlTester extensions:

To test on the server side, without a client, see the following:

Since:
1.0.0
Author:
Rossen Stoyanchev, Brian Clozel
  • Method Details

    • document

      GraphQlTester.Request<?> document(String document)
      Start defining a GraphQL request with the given document, which is the textual representation of an operation (or operations) to perform.
      Parameters:
      document - the document for the request
      Returns:
      spec for response assertions
      Throws:
      AssertionError - if the response status is not 200 (OK)
    • documentName

      GraphQlTester.Request<?> documentName(String documentName)
      Variant of document(String) that uses the given key to resolve the GraphQL document from a file with the help of the configured DocumentSource.
      Parameters:
      documentName - the name of the document to send
      Returns:
      spec for response assertions
      Throws:
      IllegalArgumentException - if the documentName cannot be resolved
      AssertionError - if the response status is not 200 (OK)
    • mutate

      Create a builder initialized from the configuration of "this" tester. Use it to build a new, independently configured instance.
    • builder

      static GraphQlTester.Builder<?> builder(GraphQlTransport transport)
      Create a builder with a custom GraphQlTransport.

      For most cases, use a transport specific extension such as HttpGraphQlTester or WebSocketGraphQlTester. This method is for use with a custom GraphQlTransport.

      Parameters:
      transport - the transport to execute requests with
      Returns:
      the builder for further initialization