testThrows

public static void testThrows<T extends Throwable>(Class<? extends Object> expectedType, Task task)(source)

Checks if the given task throws an exception. If no exception is thrown or the task throws an exception to the wrong type, an error message is printed to S_TEST_ERR.

This method is intended to be used in the context of a test case from the student.

Parameters

expectedType

the expected type of the exception

task

the task to execute

<T>

the type of the exception to check