Interface GraphQlTester.Errors
- Enclosing interface:
- GraphQlTester
public static interface GraphQlTester.Errors
Declare options to filter out expected errors or inspect all errors and verify
there are no unexpected errors.
-
Method Summary
Modifier and TypeMethodDescriptionexpect
(Predicate<ResponseError> errorPredicate) Use this to declare errors that are expected.filter
(Predicate<ResponseError> errorPredicate) Use this to filter out errors that are expected and can be ignored.satisfy
(Consumer<List<ResponseError>> errorsConsumer) Inspect errors in the response, if any.verify()
Verify there are either no errors or that there are no unexpected errors that have not beenfiltered out
.
-
Method Details
-
filter
Use this to filter out errors that are expected and can be ignored. This can be useful for warnings or other notifications returned along with the data.The configured filters are applied to all errors. Those that match are treated as expected and are ignored on
verify()
or whentraversing
to a data path.In contrast to
expect(Predicate)
, filters do not have to match any errors, and don't imply that the errors must be present.- Parameters:
errorPredicate
- the error filter to add- Returns:
- the same spec to add more filters before
verify()
-
expect
Use this to declare errors that are expected.Errors that match are treated as expected and are ignored on
verify()
or whentraversing
to a data path.In contrast to
filter(Predicate)
, use of this option does imply that errors are present or else anAssertionError
is raised.- Parameters:
errorPredicate
- the predicate for the expected error- Returns:
- the same spec to add more filters or expected errors
-
verify
GraphQlTester.Traversable verify()Verify there are either no errors or that there are no unexpected errors that have not beenfiltered out
.- Returns:
- a spec to switch to a data path
-
satisfy
Inspect errors in the response, if any. Use of this method effectively suppresses all errors and allowstraversing
to a data path.- Parameters:
errorsConsumer
- to inspect errors with- Returns:
- a spec to switch to a data path
-