ConsumerContainer { public synchronized void stopAllConsumers() { disableConsumers(consumerHolders); } ConsumerContainer(ConnectionFactory connectionFactory); void addConsumer(Consumer consumer, String queue); void addConsumer(Consumer consumer, String queue, boolean autoAck); void addConsumer(Consumer consumer, String queue, int prefetchMessageCount, int instances); void addConsumer(Consumer consumer, String queue, int instances); void addConsumer(Consumer consumer, String queue, boolean autoAck, int prefetchMessageCount, int instances); void addConsumer(Consumer consumer, String queue, boolean autoAck, int instances); synchronized void addConsumer(Consumer consumer, ConsumerConfiguration configuration, int instances); synchronized void startConsumers(Class<? extends Consumer> consumerClass); synchronized void startAllConsumers(); synchronized void stopConsumers(Class<? extends Consumer> consumerClass); synchronized void stopAllConsumers(); synchronized void reset(); List<ConsumerHolder> getEnabledConsumers(); List<ConsumerHolder> getDisabledConsumers(); List<ConsumerHolder> getActiveConsumers(); List<ConsumerHolder> getInactiveConsumers();  }
@Test public void testStopAllConsumers() throws Exception { mockConnectionOperations(); mockCheckingOperations(); mockActivatingOperations(); mockDeactivatingOperations(); PowerMock.replayAll(); consumerContainer.startAllConsumers(); consumerContainer.stopAllConsumers(); int disabledConsumerCount = consumerContainer.getDisabledConsumers().size(); Assert.assertEquals(2, disabledConsumerCount); int inactiveConsumerCount = consumerContainer.getInactiveConsumers().size(); Assert.assertEquals(2, inactiveConsumerCount); PowerMock.verifyAll(); }