RabbitMqUtils { public static void declareGlobalExchanges( String domain, Channel channel ) throws IOException { channel.exchangeDeclare( buildExchangeNameForTheDm( domain ), "topic" ); channel.exchangeDeclare( buildExchangeNameForInterApp( domain ), "topic" ); } private  RabbitMqUtils(); static void configureFactory( ConnectionFactory factory, Map<String,String> configuration ); static void closeConnection( Channel channel ); static void declareApplicationExchanges( String domain, String applicationName, Channel channel ); static void declareGlobalExchanges( String domain, Channel channel ); static String buildExchangeNameForAgent( String domain, String applicationName ); static String buildExchangeNameForTheDm( String domain ); static String buildExchangeNameForInterApp( String domain ); static String buildExchangeName( MessagingContext ctx );  }
@Test public void testDeclareGlobalExchanges() throws Exception { Channel channel = Mockito.mock( Channel.class ); RabbitMqUtils.declareGlobalExchanges( "d", channel ); Mockito.verify( channel, Mockito.times( 1 )).exchangeDeclare( "d." + EXCHANGE_DM, "topic" ); Mockito.verify( channel, Mockito.times( 1 )).exchangeDeclare( "d." + EXCHANGE_INTER_APP, "topic" ); }