xref: /haiku/headers/tools/cppunit/cppunit/NotEqualException.h (revision 58481f0f6ef1a61ba07283f012cafbc2ed874ead)
1 #ifndef NOTEQUALEXCEPTION_H
2 #define NOTEQUALEXCEPTION_H
3 
4 #include <cppunit/Exception.h>
5 
6 
7 namespace CppUnit {
8 
9 /*! \brief Exception thrown by failed equality assertions.
10  * \ingroup BrowsingCollectedTestResult
11  */
12 class CPPUNIT_API NotEqualException : public Exception
13 {
14 public:
15   /*! Constructs the exception.
16    * \param expected Text that represents the expected value.
17    * \param actual Text that represents the actual value.
18    * \param sourceLine Location of the assertion.
19    * \param additionalMessage Additionnal information provided to further qualify
20    *                          the inequality.
21    */
22   NotEqualException( std::string expected,
23                      std::string actual,
24                      SourceLine sourceLine = SourceLine(),
25                      std::string additionalMessage = "" );
26 
27 #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED
28   NotEqualException( std::string expected,
29                      std::string actual,
30                      long lineNumber,
31                      std::string fileName );
32 #endif
33 
34   NotEqualException( const NotEqualException &other );
35 
36 
37   virtual ~NotEqualException() throw();
38 
39   std::string expectedValue() const;
40 
41   std::string actualValue() const;
42 
43   std::string additionalMessage() const;
44 
45   /*! Copy operator.
46    * @param other Object to copy.
47    * @return Reference on this object.
48    */
49   NotEqualException &operator =( const NotEqualException &other );
50 
51   Exception *clone() const;
52 
53   bool isInstanceOf( const Type &type ) const;
54 
55   static Type type();
56 
57 private:
58   std::string m_expected;
59   std::string m_actual;
60   std::string m_additionalMessage;
61 };
62 
63 }  // namespace CppUnit
64 
65 #endif  // NOTEQUALEXCEPTION_H
66