summaryrefslogtreecommitdiff
path: root/cpp/src/tests/exception_test.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-09-25 14:16:51 +0000
committerAlan Conway <aconway@apache.org>2008-09-25 14:16:51 +0000
commit928b806b8bc238de9222bd81e7fba950494588b7 (patch)
tree699a4f1c38c0f2df8a3e41cb839b84f4b7ef5bcc /cpp/src/tests/exception_test.cpp
parent8fca6bbadd52582a9d0e860a29adb0365c1fb71c (diff)
downloadqpid-python-928b806b8bc238de9222bd81e7fba950494588b7.tar.gz
Added ScopedSuppressLogging, used to suppress expected error messages in tests.
For examples see src/tests/exception_test.cpp git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@698981 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/exception_test.cpp')
-rw-r--r--cpp/src/tests/exception_test.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/cpp/src/tests/exception_test.cpp b/cpp/src/tests/exception_test.cpp
index 339881fa9d..b42c1e58e0 100644
--- a/cpp/src/tests/exception_test.cpp
+++ b/cpp/src/tests/exception_test.cpp
@@ -20,6 +20,7 @@
*/
#include "unit_test.h"
+#include "test_tools.h"
#include "BrokerFixture.h"
#include "qpid/client/SubscriptionManager.h"
#include "qpid/sys/Runnable.h"
@@ -51,7 +52,10 @@ struct Catcher : public Runnable {
~Catcher() { join(); }
void run() {
- try { f(); }
+ try {
+ ScopedSuppressLogging sl; // Suppress messages for expected errors.
+ f();
+ }
catch(const Ex& e) {
caught=true;
BOOST_MESSAGE(string("Caught expected exception: ")+e.what()+"["+typeid(e).name()+"]");
@@ -76,6 +80,7 @@ struct Catcher : public Runnable {
QPID_AUTO_TEST_CASE(TestSessionBusy) {
SessionFixture f;
try {
+ ScopedSuppressLogging sl; // Suppress messages for expected errors.
f.connection.newSession(f.session.getId().getName());
BOOST_FAIL("Expected SessionBusyException for " << f.session.getId().getName());
} catch (const Exception&) {} // FIXME aconway 2008-09-22: client is not throwing correct exception.
@@ -99,6 +104,8 @@ QPID_AUTO_TEST_CASE(DisconnectedListen) {
ProxyConnection c(fix.broker->getPort());
fix.session.queueDeclare(arg::queue="q");
fix.subs.subscribe(l, "q");
+
+ ScopedSuppressLogging sl; // Suppress messages for expected errors.
Thread t(fix.subs);
fix.connection.proxy.close();
t.join();
@@ -107,6 +114,7 @@ QPID_AUTO_TEST_CASE(DisconnectedListen) {
QPID_AUTO_TEST_CASE(NoSuchQueueTest) {
ProxySessionFixture fix;
+ ScopedSuppressLogging sl; // Suppress messages for expected errors.
BOOST_CHECK_THROW(fix.subs.subscribe(fix.lq, "no such queue"), NotFoundException);
}