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.
-
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
(String name) Set the operation name.Add a variable.Add variables from aMap
.
-
Method Details
-
operationName
Set the operation name.- Parameters:
name
- the operation name- Returns:
- this request spec
-
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
Add a variable.- Parameters:
name
- the variable namevalue
- the variable value, possiblynull
since GraphQL supports providing null for a value vs not providing a value at all.- Returns:
- this request spec
-
variables
Add variables from aMap
.- Parameters:
values
- the variables to add, possibly withnull
values since GraphQL supports null for a value vs not providing it at all.- Returns:
- this request spec
- Since:
- 1.3.0
-
extension
Add a value for a protocol extension.- Parameters:
name
- the protocol extension namevalue
- the extension value- Returns:
- this request spec
-
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).
-