@@ -0,0 +1,1538 @@
+package com.workshop.wilqor.testing.bonus.examples;%0A%0Aimport org.junit.Test;%0A%0Aimport java.io.IOException;%0A%0A/**%0A * Example demonstrating basic behavior of exceptions in JUnit%0A * and serving as a base for discussing exception handling in tests.%0A *%0A * @author wilqor%0A */%0Apublic class ExceptionsExampleTest %7B%0A    @Test%0A    public void uncheckedExceptionThrown() %7B%0A        // does not need to be caught, handled properly%0A        throw new NullPointerException();%0A        // does the test pass?%0A    %7D%0A%0A    @Test%0A    public void checkedExceptionThrownAndCaught() %7B%0A        try %7B%0A            throw new IOException(%22Network connection timeout%22);%0A        %7D catch (IOException e) %7B%0A            System.err.println(%22Caught exception: %22 + e);%0A        %7D%0A        // does the test pass? was this behavior correct?%0A    %7D%0A%0A    @Test%0A    public void checkedExceptionAddedToSignature() throws IOException %7B%0A        throw new IOException(%22Network connection timeout%22);%0A        // does the test pass?%0A    %7D%0A%0A    @Test%0A    public void genericExceptionSignature() throws Exception %7B%0A        throw new CustomException(%22Custom exception with message%22);%0A        // what does it give us?%0A    %7D%0A%0A    @Test(expected = CustomException.class)%0A    public void checkedExceptionExpected() throws Exception %7B%0A        throw new CustomException(%22Custom exception with message%22);%0A        // when should we use this method?%0A    %7D%0A%0A    private static class CustomException extends Exception %7B%0A        CustomException(String message) %7B%0A            super(message);%0A        %7D%0A    %7D%0A%7D%0A

Add bonus content related to exceptions in test