@Test
public void testMetricsPublisherReset() {
HystrixCommandKey key = HystrixCommandKey.Factory.asKey("key");
HystrixMetricsPublisherCommand firstCommand = new HystrixMetricsPublisherCommandDefault(key, null, null, null, null);
HystrixMetricsPublisher firstPublisher = new CustomPublisher(firstCommand);
HystrixPlugins.getInstance().registerMetricsPublisher(firstPublisher);
HystrixMetricsPublisherCommand cmd = HystrixMetricsPublisherFactory.createOrRetrievePublisherForCommand(key, null, null, null, null);
assertSame(firstCommand, cmd);
HystrixPlugins.reset();
HystrixMetricsPublisherCommand secondCommand = new HystrixMetricsPublisherCommandDefault(key, null, null, null, null);
HystrixMetricsPublisher secondPublisher = new CustomPublisher(secondCommand);
HystrixPlugins.getInstance().registerMetricsPublisher(secondPublisher);
cmd = HystrixMetricsPublisherFactory.createOrRetrievePublisherForCommand(key, null, null, null, null);
assertNotSame(firstCommand, cmd);
assertSame(secondCommand, cmd);
}