summaryrefslogtreecommitdiff
path: root/examples/cppunittest/ExceptionTestCaseDecoratorTest.h
blob: da9d168f950e856a94198f9dacec996a5cb60441 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// //////////////////////////////////////////////////////////////////////////
// Header file ExceptionTestCaseDecoratorTest.h for class ExceptionTestCaseDecoratorTest
// (c)Copyright 2000, Baptiste Lepilleur.
// Created: 2002/08/03
// //////////////////////////////////////////////////////////////////////////
#ifndef EXCEPTIONTESTCASEDECORATORTEST_H
#define EXCEPTIONTESTCASEDECORATORTEST_H

#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestResult.h>
#include "FailureException.h"
#include "MockTestCase.h"
#include "MockTestListener.h"


/// Unit tests for ExceptionTestCaseDecoratorTest
class ExceptionTestCaseDecoratorTest : public CPPUNIT_NS::TestFixture
{
  CPPUNIT_TEST_SUITE( ExceptionTestCaseDecoratorTest );
  CPPUNIT_TEST( testNoExceptionThrownFailed );
  CPPUNIT_TEST( testExceptionThrownPass );
  CPPUNIT_TEST_SUITE_END();

public:
  /*! Constructs a ExceptionTestCaseDecoratorTest object.
   */
  ExceptionTestCaseDecoratorTest();

  /// Destructor.
  virtual ~ExceptionTestCaseDecoratorTest();

  void setUp();
  void tearDown();

  void testNoExceptionThrownFailed();
  void testExceptionThrownPass();

private:
  /// Prevents the use of the copy constructor.
  ExceptionTestCaseDecoratorTest( const ExceptionTestCaseDecoratorTest &other );

  /// Prevents the use of the copy operator.
  void operator =( const ExceptionTestCaseDecoratorTest &other );

private:
  typedef CPPUNIT_NS::ExceptionTestCaseDecorator<FailureException> FailureExceptionTestCase;

  CPPUNIT_NS::TestResult *m_result;
  MockTestListener *m_testListener;
  MockTestCase *m_test;
  FailureExceptionTestCase *m_decorator;
};



// Inlines methods for ExceptionTestCaseDecoratorTest:
// ---------------------------------------------------



#endif  // EXCEPTIONTESTCASEDECORATORTEST_H