Class ErrorCollector

java.lang.Object
org.assertj.db.api.ErrorCollector

public class ErrorCollector extends Object
Collects error messages of all AssertionErrors thrown by the proxied method.
Author:
Julien Roy
  • Constructor Details

    • ErrorCollector

      public ErrorCollector()
      Construct empty error collector.
  • Method Details

    • intercept

      @RuntimeType public Object intercept(@This Object assertion, @SuperCall Callable<?> proxy, @SuperMethod(nullIfImpossible=true) Method method, @StubValue Object stub) throws Exception
      Apply interception of assertion method to collect exception and avoid stop the assertion flow on the first error.
      Parameters:
      assertion - The assertion object proxied
      proxy - The proxy of assertion
      method - The method of assertion called
      stub - The sub value if not assert method is found
      Returns:
      The current assertion object.
      Throws:
      Exception - When interception fail
    • addError

      public void addError(Throwable error)
      Append new error to collection of errors.
      Parameters:
      error - Any throwable
    • errors

      public List<Throwable> errors()
      Return all errors collected.
      Returns:
      List of exception
    • wasSuccess

      public boolean wasSuccess()
      Return if no error collected in this instance.
      Returns:
      true if no errors.