public abstract class ExpectedThrownException extends Object
| Constructor and Description |
|---|
ExpectedThrownException(Class<? extends Exception> clazz)
Required constructor that initializes a new instance of the
ExpectedThrownException type with a reference to the class type of the
expected exception.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
execute()
Defines an abstract method to implement in subclasses that executes
code for a test that throws an expected exception.
|
void |
executeTest()
Executes test code defined in the specified ExpectedThrownException
and asserts if the exception was thrown as expected.
|
public ExpectedThrownException(Class<? extends Exception> clazz)
clazz - The class type of the expected exception.protected abstract void execute()
public void executeTest()
Exception and verifies if
the expected exception class type was actually thrown. Otherwise,
TestCase.fail(String) is called that fails the
test when the expected exception was not thrown.Copyright © 2014. All rights reserved.