...

/

Testing the Expected Exceptions

Testing the Expected Exceptions

Learn the types of exceptions and differences between them.

In addition to ensuring that the happy path through our code works, we want to verify that exceptions get thrown when expected.

Let’s examine a simple case. How do we ensure that the Account code throws an exception when a client attempts to withdraw more than the available balance?

Understanding the conditions that cause a class to throw exceptions can make life a lot easier for a client developer using the class.

JUnit supports at least three different ways of specifying that we ...

Case examination
Access this course and 1400+ top-rated courses and projects.