@@ -109,17 +109,24 @@ public void run() {
109109 }, args , "expired" );
110110 }
111111
112- public void testDeadLetterNonExistingDLX () throws Exception {
112+ public void testDeadLetterDeletedDLX () throws Exception {
113113 declareQueue (TEST_QUEUE_NAME , DLX , null , null , 1 );
114114 channel .queueBind (TEST_QUEUE_NAME , "amq.direct" , "test" );
115+ channel .queueBind (DLQ , DLX , "test" );
115116
116117 channel .exchangeDelete (DLX );
117-
118118 publishN (MSG_COUNT );
119119 sleep (100 );
120120
121- // Nothing was dead-lettered.
122121 consumeN (DLQ , 0 , WithResponse .NULL );
122+
123+ channel .exchangeDeclare (DLX , "direct" );
124+ channel .queueBind (DLQ , DLX , "test" );
125+
126+ publishN (MSG_COUNT );
127+ sleep (100 );
128+
129+ consumeN (DLQ , MSG_COUNT , WithResponse .NULL );
123130 }
124131
125132 public void testDeadLetterExchangeDeleteTwice ()
@@ -374,7 +381,8 @@ private void consumeN(String queue, int n, WithResponse withResponse)
374381 for (int x = 0 ; x < n ; x ++) {
375382 GetResponse getResponse =
376383 channel .basicGet (queue , true );
377- assertNotNull ("Message not dead-lettered" , getResponse );
384+ assertNotNull ("Messages not dead-lettered (" + (n -x ) + " left)" ,
385+ getResponse );
378386 assertEquals ("test message" , new String (getResponse .getBody ()));
379387 withResponse .process (getResponse );
380388 }
0 commit comments