Asserting Exceptions
Find out how to assert exceptions within the application code.
Introduction
Throwing exceptions is a way for a method to tell its caller that it has operated outside normal operating parameters. Normal and exceptional operations are defined by the method and its API documentation. Application code consists of code that runs without raising exceptions as well as code that raises exceptions during execution. Ideally, test cases for both should be written.
Normal and exception test case development
Normal and exception test cases are both written using asserts. When writing test cases, it is convenient to first ...