public interface GraphQlTester
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:
Modifier and Type | Interface and Description |
---|---|
static interface |
GraphQlTester.Builder<B extends GraphQlTester.Builder<B>>
A builder to create a
GraphQlTester instance. |
static interface |
GraphQlTester.Entity<D,S extends GraphQlTester.Entity<D,S>>
Contains a decoded entity and provides options to assert it
|
static interface |
GraphQlTester.EntityList<E>
Contains a List of decoded entities and provides options to assert them.
|
static interface |
GraphQlTester.Errors
Declare options to filter out expected errors or inspect all errors and verify
there are no unexpected errors.
|
static interface |
GraphQlTester.Path
Options available to assert the response values at the current path.
|
static interface |
GraphQlTester.Request<T extends GraphQlTester.Request<T>>
Declare options to gather input for a GraphQL request and execute it.
|
static interface |
GraphQlTester.Response
Declare options to check the data and errors of a GraphQL response.
|
static interface |
GraphQlTester.Subscription
Declare options available to assert a GraphQL Subscription response.
|
static interface |
GraphQlTester.Traversable
Declare options to switch to different part of the GraphQL response.
|
Modifier and Type | Method and Description |
---|---|
static GraphQlTester.Builder<?> |
builder(GraphQlTransport transport)
Create a builder with a custom
GraphQlTransport . |
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,
including selection sets and fragments.
|
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 . |
GraphQlTester.Builder<?> |
mutate()
Create a builder initialized from the configuration of "this" tester.
|
GraphQlTester.Request<?> document(String document)
document
- the document for the requestAssertionError
- if the response status is not 200 (OK)GraphQlTester.Request<?> documentName(String documentName)
document(String)
that uses the given key to resolve
the GraphQL document from a file with the help of the configured
DocumentSource
.IllegalArgumentException
- if the documentName cannot be resolvedAssertionError
- if the response status is not 200 (OK)GraphQlTester.Builder<?> mutate()
static GraphQlTester.Builder<?> builder(GraphQlTransport transport)
GraphQlTransport
.
For most cases, use a transport specific extension such as
HttpGraphQlTester
or WebSocketGraphQlTester
. This method
is for use with a custom GraphQlTransport
.
transport
- the transport to execute requests with