From 8cc8d5e6416cef620847db1eb449cd3e1116c65f Mon Sep 17 00:00:00 2001 From: Matt Broadstone Date: Wed, 4 Feb 2015 16:40:22 -0500 Subject: [PATCH] add test for invalid passive exchange declarations Verify the behavior of signaling an error if a passive exchange is declared, but not found on the server. --- tests/auto/qamqpexchange/tst_qamqpexchange.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/auto/qamqpexchange/tst_qamqpexchange.cpp b/tests/auto/qamqpexchange/tst_qamqpexchange.cpp index 92bdf72..c04869d 100644 --- a/tests/auto/qamqpexchange/tst_qamqpexchange.cpp +++ b/tests/auto/qamqpexchange/tst_qamqpexchange.cpp @@ -25,6 +25,7 @@ private Q_SLOTS: void invalidImmediateRouting(); void confirmsSupport(); void confirmDontLoseMessages(); + void passiveDeclareNotFound(); private: QScopedPointer client; @@ -190,5 +191,13 @@ void tst_QAMQPExchange::confirmDontLoseMessages() QVERIFY(defaultExchange->waitForConfirms()); } +void tst_QAMQPExchange::passiveDeclareNotFound() +{ + QAmqpExchange *nonExistentExchange = client->createExchange("this-does-not-exist"); + nonExistentExchange->declare(QAmqpExchange::Direct, QAmqpExchange::Passive); + QVERIFY(waitForSignal(nonExistentExchange, SIGNAL(error(QAMQP::Error)))); + QCOMPARE(nonExistentExchange->error(), QAMQP::NotFoundError); +} + QTEST_MAIN(tst_QAMQPExchange) #include "tst_qamqpexchange.moc"