O'Reilly logo

Quality Code: Software Testing Principles, Practices, and Patterns by Stephen Vance

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Verify the Exception Payload

We can generalize the idea of verifying the exception message. In the last section, we made a deliberate decision to temporarily ignore the cause of the exception, the other of the two attributes that could help us distinguish why the exception was thrown. We could have used the cause as an alternative means of verification or even to supplement our verification. In fact, the message and cause are the only user-settable attributes2 of the Throwable class, the base class for exceptions of all types3 in Java. Throwable closely resembles the base class of exception hierarchies in other languages and frameworks. For example, C# has the System.Exception class that has InnerException and Message attributes. C++ has only ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required