public abstract class AbstractGraphQlTesterBuilder<B extends AbstractGraphQlTesterBuilder<B>> extends Object implements GraphQlTester.Builder<B>
GraphQlTester.Builder
implementations.
Subclasses must implement GraphQlTester.Builder.build()
and call
buildGraphQlTester(GraphQlTransport)
to obtain a default, transport
agnostic GraphQlTester
. A transport specific extension can then wrap
this default tester by extending AbstractDelegatingGraphQlTester
.
AbstractDelegatingGraphQlTester
Constructor and Description |
---|
AbstractGraphQlTesterBuilder() |
Modifier and Type | Method and Description |
---|---|
protected static GraphQlTransport |
asTransport(GraphQlClient client)
For cases where the Tester needs the
GraphQlTransport , we can't use
transports directly since they are package private, but we can adapt the corresponding
GraphQlClient and adapt it to GraphQlTransport . |
protected GraphQlTester |
buildGraphQlTester(GraphQlTransport transport)
Build the default transport-agnostic client that subclasses can then wrap
with
AbstractDelegatingGraphQlTester . |
protected void |
configureJsonPathConfig(Function<com.jayway.jsonpath.Configuration,com.jayway.jsonpath.Configuration> configurer)
Allow transport-specific subclass builders to register a JSON Path
MappingProvider that matches the JSON encoding/decoding they use. |
B |
documentSource(DocumentSource documentSource)
Configure a
DocumentSource for use with
GraphQlTester.documentName(String) for resolving a document by name. |
B |
errorFilter(Predicate<ResponseError> predicate)
Configure a global
filter that
applies to all requests. |
protected Consumer<AbstractGraphQlTesterBuilder<?>> |
getBuilderInitializer()
Subclasses call this from
GraphQlTester.Builder.build() to obtain a Consumer to
initialize new builder instances with, based on "this" builder. |
B |
responseTimeout(Duration timeout)
Max amount of time to wait for a GraphQL response.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
build
public B errorFilter(Predicate<ResponseError> predicate)
GraphQlTester.Builder
filter
that
applies to all requests.errorFilter
in interface GraphQlTester.Builder<B extends AbstractGraphQlTesterBuilder<B>>
predicate
- the error filter to addpublic B documentSource(DocumentSource documentSource)
GraphQlTester.Builder
DocumentSource
for use with
GraphQlTester.documentName(String)
for resolving a document by name.
By default, this is set to ResourceDocumentSource
with
classpath location "graphql-test/"
and
ResourceDocumentSource.FILE_EXTENSIONS
as extensions.
documentSource
in interface GraphQlTester.Builder<B extends AbstractGraphQlTesterBuilder<B>>
public B responseTimeout(Duration timeout)
GraphQlTester.Builder
By default this is set to 5 seconds.
responseTimeout
in interface GraphQlTester.Builder<B extends AbstractGraphQlTesterBuilder<B>>
timeout
- the response timeout valueprotected void configureJsonPathConfig(Function<com.jayway.jsonpath.Configuration,com.jayway.jsonpath.Configuration> configurer)
MappingProvider
that matches the JSON encoding/decoding they use.protected GraphQlTester buildGraphQlTester(GraphQlTransport transport)
AbstractDelegatingGraphQlTester
.protected Consumer<AbstractGraphQlTesterBuilder<?>> getBuilderInitializer()
GraphQlTester.Builder.build()
to obtain a Consumer
to
initialize new builder instances with, based on "this" builder.protected static GraphQlTransport asTransport(GraphQlClient client)
GraphQlTransport
, we can't use
transports directly since they are package private, but we can adapt the corresponding
GraphQlClient
and adapt it to GraphQlTransport
.