Interface GraphQlTester.Request<T extends GraphQlTester.Request<T>>
- Type Parameters:
T
- the type of request
- Enclosing interface:
GraphQlTester
public static interface GraphQlTester.Request<T extends GraphQlTester.Request<T>>
Declare options to gather input for a GraphQL request and execute it.
- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev, Brian Clozel
-
Method Summary
Modifier and TypeMethodDescriptionexecute()
Execute the GraphQL request and return a spec for further inspection of response data and errors.void
Execute the GraphQL request and verify the response contains no errors.Execute the GraphQL request as a subscription and return a spec with options to transform the result stream.Add a value for a protocol extension.Append the given fragment section to therequest document
.fragmentName
(String fragmentName) Variant offragment(String)
that uses the given key to resolve the GraphQL fragment document from a file with the help of the configuredDocumentSource
.operationName
(@Nullable String name) Set the operation name.Add a variable.Add variables from aMap
.
-
Method Details
-
operationName
-
fragment
Append the given fragment section to therequest document
. A fragment describes a selection of fields to be included in the query when needed and is defined with thefragment
keyword.- Parameters:
fragment
- the fragment definition- Returns:
- this request spec
- Since:
- 1.3
- See Also:
-
fragmentName
Variant offragment(String)
that uses the given key to resolve the GraphQL fragment document from a file with the help of the configuredDocumentSource
.- Parameters:
fragmentName
- the name of the fragment to append- Returns:
- this request spec
- Throws:
IllegalArgumentException
- if the fragmentName cannot be resolved- Since:
- 1.3
-
variable
-
variables
-
extension
-
execute
GraphQlTester.Response execute()Execute the GraphQL request and return a spec for further inspection of response data and errors.- Returns:
- options for asserting the response
- Throws:
AssertionError
- if the request is performed over HTTP and the response status is not 200 (OK).
-
executeAndVerify
void executeAndVerify()Execute the GraphQL request and verify the response contains no errors. -
executeSubscription
GraphQlTester.Subscription executeSubscription()Execute the GraphQL request as a subscription and return a spec with options to transform the result stream.- Returns:
- spec with options to transform the subscription result stream
- Throws:
AssertionError
- if the request is performed over HTTP and the response status is not 200 (OK).
-