Expected Exceptions using JUnit
We will learn the Expected Exception Rules with a JUnit Testing example.
We'll cover the following...
We'll cover the following...
JUnit allows us to define custom rules which can provide greater control over what happens during the flow of test execution.
In a sense, custom rules provide a capability similar to aspect-oriented programming in that they provide a way to automatically attach a cross-cutting concern to a set of tests.
JUnit provides a few useful rules out of the box, meaning we don’t have to code them ourselves.
The
ExpectedException
rule is particularly helpful, as it lets us combine the best ...