Class AbstractGraphQlTesterBuilder<B extends AbstractGraphQlTesterBuilder<B>>
java.lang.Object
org.springframework.graphql.test.tester.AbstractGraphQlTesterBuilder<B>
- All Implemented Interfaces:
GraphQlTester.Builder<B>
- Direct Known Subclasses:
DefaultRSocketGraphQlTesterBuilder
public abstract class AbstractGraphQlTesterBuilder<B extends AbstractGraphQlTesterBuilder<B>>
extends Object
implements GraphQlTester.Builder<B>
Abstract, base class for transport specific
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.
- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static org.springframework.graphql.client.GraphQlTransportasTransport(org.springframework.graphql.client.GraphQlClient client) For cases where the Tester needs theGraphQlTransport, we can't use transports directly since they are package private, but we can adapt the correspondingGraphQlClientand adapt it toGraphQlTransport.protected GraphQlTesterbuildGraphQlTester(org.springframework.graphql.client.GraphQlTransport transport) Build the default transport-agnostic client that subclasses can then wrap withAbstractDelegatingGraphQlTester.protected voidconfigureJsonPathConfig(Function<com.jayway.jsonpath.Configuration, com.jayway.jsonpath.Configuration> configurer) Allow transport-specific subclass builders to register a JSON PathMappingProviderthat matches the JSON encoding/decoding they use.documentSource(org.springframework.graphql.support.DocumentSource documentSource) Configure aDocumentSourcefor use withGraphQlTester.documentName(String)for resolving a document by name.errorFilter(Predicate<org.springframework.graphql.ResponseError> predicate) Configure a globalfilterthat applies to all requests.protected Consumer<AbstractGraphQlTesterBuilder<?>>Subclasses call this fromGraphQlTester.Builder.build()to obtain aConsumerto initialize new builder instances with, based on "this" builder.responseTimeout(Duration timeout) Max amount of time to wait for a GraphQL response.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.graphql.test.tester.GraphQlTester.Builder
build
-
Constructor Details
-
AbstractGraphQlTesterBuilder
public AbstractGraphQlTesterBuilder()
-
-
Method Details
-
errorFilter
Description copied from interface:GraphQlTester.BuilderConfigure a globalfilterthat applies to all requests.- Specified by:
errorFilterin interfaceGraphQlTester.Builder<B extends AbstractGraphQlTesterBuilder<B>>- Parameters:
predicate- the error filter to add- Returns:
- the same builder instance
-
documentSource
Description copied from interface:GraphQlTester.BuilderConfigure aDocumentSourcefor use withGraphQlTester.documentName(String)for resolving a document by name.By default, this is set to
ResourceDocumentSourcewith classpath location"graphql-test/"andResourceDocumentSource.FILE_EXTENSIONSas extensions.- Specified by:
documentSourcein interfaceGraphQlTester.Builder<B extends AbstractGraphQlTesterBuilder<B>>
-
responseTimeout
Description copied from interface:GraphQlTester.BuilderMax amount of time to wait for a GraphQL response.By default this is set to 5 seconds.
- Specified by:
responseTimeoutin interfaceGraphQlTester.Builder<B extends AbstractGraphQlTesterBuilder<B>>- Parameters:
timeout- the response timeout value
-
configureJsonPathConfig
protected void configureJsonPathConfig(Function<com.jayway.jsonpath.Configuration, com.jayway.jsonpath.Configuration> configurer) Allow transport-specific subclass builders to register a JSON PathMappingProviderthat matches the JSON encoding/decoding they use. -
buildGraphQlTester
protected GraphQlTester buildGraphQlTester(org.springframework.graphql.client.GraphQlTransport transport) Build the default transport-agnostic client that subclasses can then wrap withAbstractDelegatingGraphQlTester. -
getBuilderInitializer
Subclasses call this fromGraphQlTester.Builder.build()to obtain aConsumerto initialize new builder instances with, based on "this" builder. -
asTransport
protected static org.springframework.graphql.client.GraphQlTransport asTransport(org.springframework.graphql.client.GraphQlClient client) For cases where the Tester needs theGraphQlTransport, we can't use transports directly since they are package private, but we can adapt the correspondingGraphQlClientand adapt it toGraphQlTransport.
-