The class NotEqualException (see Figure C-8) is a subclass of Exception . A NotEqualException is thrown when an equality assertion fails. Its Type is CppUnit::NotEqualException .

NotEqualException belongs to the namespace CppUnit . It is declared in NotEqualException.h and implemented in NotEqualException.cpp .

Figure C-8. The class NotEqualException


 class NotEqualException : public Exception 


NotEqualException(string expected, string actual, SourceLine sourceLine = SourceLine( ), string additionalMessage = "")

A constructor for NotEqualException . The string arguments expected and actual represent the values that fail the equality test and cause the NotEqualException . The sourceLine and additionalMessage arguments have default empty values.

NotEqualException(const NotEqualException& other)

A copy constructor.

virtual ~NotEqualException( ) throw( )

A destructor.

Public Methods

NotEqualException& operator=(const NotEqualException& other)

A copy operator.

string actualValue( ) const

Returns the actual value.

string additionalMessage( ) const

Returns the additionalMessage .

virtual Exception *clone( ) const

Returns a copy of the NotEqualException .

string expectedValue( ) const

Returns the expected value.

virtual bool isInstanceOf(const Type& type) const

Returns TRUE if the NotEqualException is of the given Type . Used for runtime Exception type identification.

static Type type( )

Returns CppUnit::NotEqualException .

Protected/Private Methods



string m_actual

The actual value for the equality test ( private ).

string m_additionalMessage

An assertion failure message ( private ).

string m_expected

The expected value for the equality test ( private ).

Unit Test Frameworks
Unit Test Frameworks
ISBN: 0596006896
EAN: 2147483647
Year: 2006
Pages: 146
Authors: Paul Hamill © 2008-2017.
If you may any questions please contact us: