Question: The JUnit tests for two classes contain a check exception named DealWithMeException and an unchecked exception named UnfixableException. Write these two exceptions. import static org.junit.Assert.assertEquals;

The JUnit tests for two classes contain a check exception named DealWithMeException and an unchecked exception named UnfixableException. Write these two exceptions.

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class ExceptionsTest {

@Test public final void testCheckedException() { Class cut = DealWithMeException.class; assertEquals("To make a class a checked exception it needs be a subclass of the appropriate Java class", Exception.class, cut.getSuperclass()); }

@Test public final void testUncheckedException() { Class cut = UnfixableException.class; assertEquals("To make a class an unchecked exception it needs be a subclass of the appropriate Java class", RuntimeException.class, cut.getSuperclass()); }

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!