SysTestCase.parmExceptionExpected Method [AX 2012]

Determines whether an exception is expected in the current test.


public boolean parmExceptionExpected([boolean _value, str _exceptionMessage])

Run On



  • _value
    Type: boolean
    A Boolean value that indicates whether an exception is expected; optional.
  • _exceptionMessage
    Type: str
    The exception message of the expected exception; optional.

Return Value

Type: boolean
true if an exception is expected; otherwise, false.


If the exception message is specified, the message must match the thrown exception exactly; otherwise, any exception thrown is acceptable.


The following example demonstrates how the SysTestCase.parmExceptionExpected method could be used to test the fictitious Employee class.

void testRetire() 
    // Create an instance of the employee. 
    Employee employee = new Employee(); 
    // Call the retire method, first time should be successful. 
    // Assert that an exception is expected. 
    this.parmExceptionExpected(true, "Already retired"); 
    // Call the retire method. An exception is expected. 

See Also

SysTestCase Class

How to: Test Exceptions Using a Test Case

Unit Test Framework

Walkthrough: Testing a Class Using the Unit Test Framework