Create a public class called Catcher
that defines a single class method named catcher
.
catcher
takes, as a single parameter, a Faulter
that has a fault
method.
You should call that fault
method.
If it generates no exception, you should return 0.
If it generates a null pointer exception, you should return 1.
If it throws an illegal argument exception, you should return 2.
If it creates an illegal state exception, you should return 3.
If it generates an array index out of bounds exception, you should return 4.
You're challenge is to write tests for this problem described above.
Stuck? You may find these lessons helpful: