I have a class with 4 parametres. Also have a test that puts null object. Is it possible to catch specificaly this null? I mean some tests put IlligalArgumentException.class inside tests . So if I try to catch this null object with try catch block for whole costructor block this one works but other tests crushes and vice versa.
class Quadrilateral extends Figure{
Quadrilateral(Point a, Point b, Point c, Point d){
}
}
@Test
void testConstructor() {
Figure q = null;
q = q(0, 0, 0, 1, 1, 1, 1, 0);
q = q(-2, 2, -3, 1, 0, 1, 0, 2);
}
@Test
void testConstructorNullACase() {
assertThrows(IllegalArgumentException.class, () -> q(null, new Point(-3, 1), new Point(0, 1), new Point(1, 9)));
}