@@ -58,7 +58,7 @@ public void testDeclareQueueWithInvalidDeadLetterExchangeArg()
5858 try {
5959 declareQueue (133 );
6060 fail ("x-dead-letter-exchange must be a valid exchange name" );
61- } catch (IOException ex ) {
61+ } catch (IOException ex ) {
6262 checkShutdownSignal (AMQP .PRECONDITION_FAILED , ex );
6363 }
6464 }
@@ -68,11 +68,27 @@ public void testDeclareQueueWithInvalidDeadLetterRoutingKeyArg()
6868 {
6969 try {
7070 declareQueue ("foo" , "amq.direct" , 144 , null );
71- } catch (IOException ex ) {
71+ fail ("x-dead-letter-routink-key must be a string" );
72+ } catch (IOException ex ) {
7273 checkShutdownSignal (AMQP .PRECONDITION_FAILED , ex );
7374 }
7475 }
7576
77+ public void testDeclareQueueWithRoutingKeyButNoDeadLetterExchange ()
78+ throws IOException
79+ {
80+ try {
81+ Map <String , Object > args = new HashMap <String , Object >();
82+ args .put (DLX_RK_ARG , "foo" );
83+
84+ channel .queueDeclare ("bar" , false , true , false , args );
85+ fail ("dlx must be defined if dl-rk is set" );
86+ } catch (IOException ex ) {
87+ checkShutdownSignal (AMQP .PRECONDITION_FAILED , ex );
88+ }
89+
90+ }
91+
7692 public void testDeadLetterQueueTTLExpiredMessages () throws Exception {
7793 Map <String , Object > args = new HashMap <String , Object >();
7894 args .put ("x-message-ttl" , 1000 );
@@ -325,7 +341,7 @@ public void process(GetResponse getResponse) {
325341 private void sleep (long millis ) {
326342 try {
327343 Thread .sleep (millis );
328- } catch (InterruptedException ex ) {
344+ } catch (InterruptedException ex ) {
329345 // whoosh
330346 }
331347 }
0 commit comments