CFIXCC_METHOD_EXPECT_EXCEPTION
Used to add a test method to the fixture that is expected to throw an exception of a particular type. If the method does not throw this exception, the test is treated as having failed. If the method throws an exception of a different, non-compatible type, CFIXCC_METHOD_EXPECT_EXCEPTION will not handle this exception. Rather, the exception is treated as unexpected and the default handling of unexpected exception applies.
CFIXCC_METHOD_EXPECT_EXCEPTION may be used any number of times per fixture.
CFIXCC_METHOD_EXPECT_EXCEPTION( Method, ExceptionClass )
Test methods must have the following signature:
void TestMethod();
Exceptions are caught by reference. Heap allocated exceptions are not supported by CFIXCC_METHOD_EXPECT_EXCEPTION.
#include <cfixcc.h>
class FooException {};
class SimpleFixture : public cfixcc::TestFixture
{
public:
void Method01()
{
...
}
void MethodThatThrows()
{
throw FooException();
}
};
CFIXCC_BEGIN_CLASS( SimpleFixture )
CFIXCC_METHOD( Method01 )
CFIXCC_METHOD_EXPECT_EXCEPTION( MethodThatThrows, FooException )
CFIXCC_END_CLASS()



