1
// //////////////////////////////////////////////////////////////////////////
2
// Implementation file ExceptionTestCaseDecoratorTest.cpp for class ExceptionTestCaseDecoratorTest
3
// (c)Copyright 2000, Baptiste Lepilleur.
5
// //////////////////////////////////////////////////////////////////////////
7
#include "ExtensionSuite.h"
8
#include "ExceptionTestCaseDecoratorTest.h"
10
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ExceptionTestCaseDecoratorTest,
11
extensionSuiteName() );
14
ExceptionTestCaseDecoratorTest::ExceptionTestCaseDecoratorTest()
19
ExceptionTestCaseDecoratorTest::~ExceptionTestCaseDecoratorTest()
25
ExceptionTestCaseDecoratorTest::setUp()
27
m_testListener = new MockTestListener( "mock-testlistener" );
28
m_result = new CPPUNIT_NS::TestResult();
29
m_result->addListener( m_testListener );
31
m_test = new MockTestCase( "mock-decorated-testcase" );
32
m_decorator = new FailureExceptionTestCase( m_test );
37
ExceptionTestCaseDecoratorTest::tearDown()
41
delete m_testListener;
46
ExceptionTestCaseDecoratorTest::testNoExceptionThrownFailed()
48
m_testListener->setExpectedAddFailureCall(1);
49
m_test->setExpectedSetUpCall();
50
m_test->setExpectedRunTestCall();
51
m_test->setExpectedTearDownCall();
53
m_decorator->run( m_result );
55
m_testListener->verify();
60
ExceptionTestCaseDecoratorTest::testExceptionThrownPass()
62
m_testListener->setExpectNoFailure();
63
m_test->setExpectedSetUpCall();
64
m_test->setExpectedRunTestCall();
65
m_test->setExpectedTearDownCall();
66
m_test->makeRunTestThrow();
68
m_decorator->run( m_result );
70
m_testListener->verify();