3636import com .rabbitmq .client .ShutdownSignalException ;
3737import com .rabbitmq .client .test .BrokerTestCase ;
3838
39+ /* Declare an exchange, bind a queue to it, then try to delete it,
40+ * setting if-unused to true. This should throw an exception. */
3941public class ExchangeDeleteIfUnused extends BrokerTestCase {
4042 private final static String EXCHANGE_NAME = "xchg1" ;
4143 private final static String ROUTING_KEY = "something" ;
@@ -56,17 +58,14 @@ protected void releaseResources()
5658 super .releaseResources ();
5759 }
5860
61+ /* Attempt to Exchange.Delete(ifUnused = true) a used exchange.
62+ * Should throw an exception. */
5963 public void testExchangeDelete () {
6064 try {
61- // exchange.delete(ifUnused = true)
62- // should throw a channel exception if the exchange is being used
6365 channel .exchangeDelete (EXCHANGE_NAME , true );
6466 fail ("Exception expected if exchange in use" );
6567 } catch (IOException e ) {
66- Throwable t = e .getCause ();
67- assertTrue ("Exception should be a ShutdownSignalException" ,
68- t instanceof ShutdownSignalException );
69- assertTrue ("Exception should contain ``in use''" , t .getMessage ().toLowerCase ().contains ("in use" ));
68+ checkShutdownSignal (406 , e );
7069 }
7170 }
7271}
0 commit comments