}
}).when(mockConnectionFactory).newConnection((ExecutorService) null);
CachingConnectionFactory ccf = new CachingConnectionFactory(mockConnectionFactory);
ccf.setCacheMode(CacheMode.CONNECTION);
ccf.afterPropertiesSet();
RabbitAdmin admin = new RabbitAdmin(ccf);
GenericApplicationContext context = new GenericApplicationContext();
Queue queue = new Queue("foo");
context.getBeanFactory().registerSingleton("foo", queue);