@@ -165,21 +165,42 @@ public void testTopicRouting() throws Exception {
165165 }
166166
167167 public void testUnbind () throws Exception {
168- AMQP .Queue .DeclareOk ok = channel .queueDeclare ();
169- String queue = ok .getQueue ();
170168
171- String routingKey = "quay" ;
172169 String x = "amq.direct" ;
170+ String q = "testUnbind" ;
171+ String routingKey = "quay" ;
173172
174- channel .queueBind (queue , x , routingKey );
173+ AMQP .Queue .DeclareOk ok = channel .queueDeclare (q );
174+ channel .queueBind (q , x , routingKey );
175175 channel .basicPublish (x , routingKey , null , "foobar" .getBytes ());
176- checkGet (queue , true );
176+ checkGet (q , true );
177+
178+ String [][] tests = new String [][] {
179+ new String [] {"unknown_queue" , x , routingKey },
180+ new String [] {q , "unknown_exchange" , routingKey },
181+ new String [] {"unknown_queue" , "unknown_exchange" , routingKey },
182+ // see bug 20633
183+ // new String[] {q, x, "unknown_rk"},
184+ new String [] {"unknown_queue" , "unknown_exchange" , "unknown_rk" }
185+ };
186+
187+ for (int i = 0 ; i < tests .length ; i ++) {
188+
189+ String [] test = tests [i ];
190+ try {
191+ channel .queueUnbind (test [0 ], test [1 ], test [2 ]);
192+ fail ("expected not_found in test " + i );
193+ } catch (IOException ee ) {
194+ checkShutdownSignal (AMQP .NOT_FOUND , ee );
195+ openChannel ();
196+ }
197+ }
177198
178- channel .queueUnbind (queue , x , routingKey );
199+ channel .queueUnbind (q , x , routingKey );
179200
180201 channel .basicPublish (x , routingKey , null , "foobar" .getBytes ());
181- checkGet (queue , false );
202+ checkGet (q , false );
182203
183- channel .queueDelete (queue );
204+ channel .queueDelete (q );
184205 }
185206}
0 commit comments