Skip to content

Commit

Permalink
Add missing reset for CommandExecutionHook in HystrixPlugins.UnitTest…
Browse files Browse the repository at this point in the history
…#reset
  • Loading branch information
cgray committed Apr 4, 2014
1 parent 0494949 commit 5b12dc8
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicReference;

import com.netflix.hystrix.strategy.executionhook.HystrixCommandExecutionHook;
import com.netflix.hystrix.strategy.executionhook.HystrixCommandExecutionHookDefault;
import org.junit.After;
import org.junit.Test;

Expand All @@ -31,6 +33,23 @@ public void reset() {
HystrixPlugins.getInstance().metricsPublisher.set(null);
HystrixPlugins.getInstance().notifier.set(null);
HystrixPlugins.getInstance().propertiesFactory.set(null);
HystrixPlugins.getInstance().commandExecutionHook.set(null);
}

@Test
public void testCommandExecutionHookDefaultImpl() {
HystrixCommandExecutionHook impl = HystrixPlugins.getInstance().getCommandExecutionHook();
assertTrue(impl instanceof HystrixCommandExecutionHookDefault);
}

@Test
public void testCommandExecutionHookViaRegisterMethod() {
HystrixPlugins.getInstance().registerCommandExecutionHook(new HystrixCommandExecutionHookTestImpl());
HystrixCommandExecutionHook impl = HystrixPlugins.getInstance().getCommandExecutionHook();
assertTrue(impl instanceof HystrixCommandExecutionHookTestImpl);
}

public static class HystrixCommandExecutionHookTestImpl extends HystrixCommandExecutionHook {
}

@Test
Expand Down

0 comments on commit 5b12dc8

Please sign in to comment.