expectedException

expectedException(params: ParamListType);

The expectedException method of the JadeTestCase class is invoked by a user test method to register exceptions that are expected during execution of the test method.

A test method that encounters an exception is considered to have failed, unless the exception is registered as an expected exception.

The params parameter specifies expected exceptions by the class of the exception or the errorCode property.

In the following example, a 1035 (String too long) exception, a 5011 (Record truncated) exception, and any exception of type FileException are expected.

someTest() unitTest;
begin
    expectedException(1035, FileException, 5011);
    // test instructions omitted
end;

You can also register expected exceptions by calling the expectedException method a number of times, as shown in the following code fragment.

    expectedException(1035);
    expectedException(FileException);
    expectedException(5011);