Skip to content

Commit 36ef37e

Browse files
committed
Add Throwable.class test
1 parent e2ce168 commit 36ef37e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/test/java/pl/mperor/interview/tasks/QuizQuestionsTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,4 +301,13 @@ public boolean finallyVsTry() {
301301
return false;
302302
}
303303
}
304+
305+
@Test
306+
public void testThrowableInheritanceHierarchy() {
307+
// What is the inheritance hierarchy for the Throwable class in Java?
308+
309+
assertInstanceOf(Throwable.class, new Exception());
310+
assertInstanceOf(Throwable.class, new Error());
311+
assertInstanceOf(Exception.class, new RuntimeException());
312+
}
304313
}

0 commit comments

Comments
 (0)