1#ifndef CPPUNIT_TESTFAILURE_H    // -*- C++ -*-
2#define CPPUNIT_TESTFAILURE_H
3
4#include <cppunit/Portability.h>
5#include <string>
6
7namespace CppUnit {
8
9class Exception;
10class SourceLine;
11class Test;
12
13
14/*! \brief Record of a failed Test execution.
15 * \ingroup BrowsingCollectedTestResult
16 *
17 * A TestFailure collects a failed test together with
18 * the caught exception.
19 *
20 * TestFailure assumes lifetime control for any exception
21 * passed to it.
22 */
23class CPPUNIT_API TestFailure
24{
25public:
26  TestFailure( Test *failedTest,
27               Exception *thrownException,
28               bool isError );
29
30  virtual ~TestFailure ();
31
32  virtual Test *failedTest() const;
33
34  virtual Exception *thrownException() const;
35
36  virtual SourceLine sourceLine() const;
37
38  virtual bool isError() const;
39
40  virtual std::string failedTestName() const;
41
42  virtual std::string toString() const;
43
44  virtual TestFailure *clone() const;
45
46protected:
47  Test *m_failedTest;
48  Exception *m_thrownException;
49  bool m_isError;
50
51private:
52  TestFailure( const TestFailure &other );
53  TestFailure &operator =( const TestFailure& other );
54};
55
56
57} // namespace CppUnit
58
59#endif // CPPUNIT_TESTFAILURE_H
60