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 Details

    • filter

      GraphQlTester.Errors filter(Predicate<ResponseError> errorPredicate)
      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 when traversing 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

      GraphQlTester.Errors expect(Predicate<ResponseError> errorPredicate)
      Use this to declare errors that are expected.

      Errors that match are treated as expected and are ignored on verify() or when traversing to a data path.

      In contrast to filter(Predicate), use of this option does imply that errors are present or else an AssertionError is raised.

      Parameters:
      errorPredicate - the predicate for the expected error
      Returns:
      the same spec to add more filters or expected errors
    • verify

      Verify there are either no errors or that there are no unexpected errors that have not been filtered 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 allows traversing to a data path.
      Parameters:
      errorsConsumer - to inspect errors with
      Returns:
      a spec to switch to a data path