~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to lib/cppunit-1.10.0/examples/cppunittest/ExceptionTestCaseDecoratorTest.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2006-11-11 10:32:06 UTC
  • Revision ID: james.westby@ubuntu.com-20061111103206-f3p0r9g0vq44rp3r
Tags: upstream-3.0.PRE5
ImportĀ upstreamĀ versionĀ 3.0.PRE5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// //////////////////////////////////////////////////////////////////////////
 
2
// Implementation file ExceptionTestCaseDecoratorTest.cpp for class ExceptionTestCaseDecoratorTest
 
3
// (c)Copyright 2000, Baptiste Lepilleur.
 
4
// Created: 2002/08/03
 
5
// //////////////////////////////////////////////////////////////////////////
 
6
 
 
7
#include "ExtensionSuite.h"
 
8
#include "ExceptionTestCaseDecoratorTest.h"
 
9
 
 
10
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ExceptionTestCaseDecoratorTest,
 
11
                                       extensionSuiteName() );
 
12
 
 
13
 
 
14
ExceptionTestCaseDecoratorTest::ExceptionTestCaseDecoratorTest()
 
15
{
 
16
}
 
17
 
 
18
 
 
19
ExceptionTestCaseDecoratorTest::~ExceptionTestCaseDecoratorTest()
 
20
{
 
21
}
 
22
 
 
23
 
 
24
void 
 
25
ExceptionTestCaseDecoratorTest::setUp()
 
26
{
 
27
  m_testListener = new MockTestListener( "mock-testlistener" );
 
28
  m_result = new CPPUNIT_NS::TestResult();
 
29
  m_result->addListener( m_testListener );
 
30
 
 
31
  m_test = new MockTestCase( "mock-decorated-testcase" );
 
32
  m_decorator = new FailureExceptionTestCase( m_test );
 
33
}
 
34
 
 
35
 
 
36
void 
 
37
ExceptionTestCaseDecoratorTest::tearDown()
 
38
{
 
39
  delete m_decorator;
 
40
  delete m_result;
 
41
  delete m_testListener;
 
42
}
 
43
 
 
44
 
 
45
void 
 
46
ExceptionTestCaseDecoratorTest::testNoExceptionThrownFailed()
 
47
{
 
48
  m_testListener->setExpectedAddFailureCall(1);
 
49
  m_test->setExpectedSetUpCall();
 
50
  m_test->setExpectedRunTestCall();
 
51
  m_test->setExpectedTearDownCall();
 
52
 
 
53
  m_decorator->run( m_result );
 
54
 
 
55
  m_testListener->verify();
 
56
}
 
57
 
 
58
 
 
59
void 
 
60
ExceptionTestCaseDecoratorTest::testExceptionThrownPass()
 
61
{
 
62
  m_testListener->setExpectNoFailure();
 
63
  m_test->setExpectedSetUpCall();
 
64
  m_test->setExpectedRunTestCall();
 
65
  m_test->setExpectedTearDownCall();
 
66
  m_test->makeRunTestThrow();
 
67
 
 
68
  m_decorator->run( m_result );
 
69
 
 
70
  m_testListener->verify();
 
71
}