diff --git a/lectures/revealjs/07-lecture.adoc b/lectures/revealjs/07-lecture.adoc index 85725878868fcf780a9426219e67674765887082..18a7804fdde34d2f61b08250dd1353f12806124c 100644 --- a/lectures/revealjs/07-lecture.adoc +++ b/lectures/revealjs/07-lecture.adoc @@ -217,11 +217,29 @@ public class FoobarTest { |=== +== Expecting exceptions (1) + +``` java +@Test +void testAssertingExpectedException() { + Assertions.assertThrows(<ExpectedException.class>, () -> { + <code expected to throw exception>; + }); +} +``` + +== Expecting exceptions (2) + +- if the code throws +** the exception class that is expected the the test will PASS +** a descendent class exception that is expected the the test will PASS +** a different exception type the test will FAIL +** throws no exception the test will FAIL + [background-color = "#124990"] [color = "#fff6d5"] == Testing in todo-list example - include::{includedir}footer.adoc[] \ No newline at end of file