AssertionFailedError

Description

AssertionFailedError (see Figure B-2) is a class representing an assertion failure. Aside from being a distinct subclass, it is otherwise identical to Error . Thus, it is Throwable and contains a stack trace.

The assert methods in Assert throw an AssertionFailedError (or a subclass of it) when an assertion fails. The AssertionFailedError conveniently captures the stack trace of the code location from which it was thrown, making it easy to find the assertion that failed.