KeeperStateChangeJob extends AbstractCommand<Void> implements RequestResponseCommand<Void> { public void setActiveSuccessCommand(Command<?> activeSuccessCommand) { this.activeSuccessCommand = activeSuccessCommand; } KeeperStateChangeJob(List<KeeperMeta> keepers,
								Pair<String, Integer> activeKeeperMaster,
								RouteMeta routeForActiveKeeper,
								SimpleKeyedObjectPool<Endpoint, NettyClient> clientPool
			, ScheduledExecutorService scheduled, Executor executors);  KeeperStateChangeJob(List<KeeperMeta> keepers,
								Pair<String, Integer> activeKeeperMaster,
								RouteMeta routeForActiveKeeper,
								SimpleKeyedObjectPool<Endpoint, NettyClient> clientPool
			, int delayBaseMilli, int retryTimes, ScheduledExecutorService scheduled, Executor executors); @Override String getName(); void setActiveSuccessCommand(Command<?> activeSuccessCommand); @Override String toString(); @Override int getCommandTimeoutMilli();  }
@Test public void testHookSuccess() throws Exception{ startServer(keepers.get(0).getPort(), "+OK\r\n"); startServer(keepers.get(1).getPort(), "+OK\r\n"); job.setActiveSuccessCommand(activeSuccessCommand); job.execute().get(2000, TimeUnit.MILLISECONDS); verify(activeSuccessCommand).execute(); }
@Test public void testHookFail() throws InterruptedException, ExecutionException, TimeoutException{ job.setActiveSuccessCommand(activeSuccessCommand); try{ job.execute().get(delayBaseMilli, TimeUnit.MILLISECONDS); Assert.fail(); }catch(TimeoutException e){ } verifyZeroInteractions(activeSuccessCommand); }