Skip to content

Commit

Permalink
Merge pull request Netflix#240 from chrisgray/bug/resetCommandHook
Browse files Browse the repository at this point in the history
Add missing reset for CommandExecutionHook in HystrixPlugins.UnitTest#re...
  • Loading branch information
benjchristensen committed Apr 15, 2014
2 parents a9b432d + 5b12dc8 commit c8333a6
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 c8333a6

Please sign in to comment.