@Test public void testRestart() { Restartable restartable = Mockito.mock(Restartable.class); RestartStrategyListener listener = Mockito.mock(RestartStrategyListener.class); NoRestartRestartStrategy strategy = new NoRestartRestartStrategy(); strategy.addRestartStrategyListener(listener); RestartStrategyInstance instance = strategy.newInstance(restartable); Assert.assertFalse(instance.isRestarting()); Mockito.verify(restartable, Mockito.times(1)).restartComplete(false); Mockito.verify(listener, Mockito.times(1)).onRestartFailure(strategy, restartable); Mockito.verify(listener, Mockito.times(0)).onRestartAttempt(strategy, restartable, true); Mockito.verify(listener, Mockito.times(0)).onRestartSuccess(strategy, restartable); }
@Override public RestartStrategyInstance<T> newInstance(T restartable) { NoRestartRestartStrategyInstance<T> instance = new NoRestartRestartStrategyInstance<T>(restartable, this); instance.startRestartAttempts(); return instance; }
NoRestartRestartStrategy extends BaseRestartStrategy<T> { @Override public RestartStrategyInstance<T> newInstance(T restartable) { NoRestartRestartStrategyInstance<T> instance = new NoRestartRestartStrategyInstance<T>(restartable, this); instance.startRestartAttempts(); return instance; } }
NoRestartRestartStrategy extends BaseRestartStrategy<T> { @Override public RestartStrategyInstance<T> newInstance(T restartable) { NoRestartRestartStrategyInstance<T> instance = new NoRestartRestartStrategyInstance<T>(restartable, this); instance.startRestartAttempts(); return instance; }  }
NoRestartRestartStrategy extends BaseRestartStrategy<T> { @Override public RestartStrategyInstance<T> newInstance(T restartable) { NoRestartRestartStrategyInstance<T> instance = new NoRestartRestartStrategyInstance<T>(restartable, this); instance.startRestartAttempts(); return instance; }  @Override RestartStrategyInstance<T> newInstance(T restartable); }
NoRestartRestartStrategy extends BaseRestartStrategy<T> { @Override public RestartStrategyInstance<T> newInstance(T restartable) { NoRestartRestartStrategyInstance<T> instance = new NoRestartRestartStrategyInstance<T>(restartable, this); instance.startRestartAttempts(); return instance; }  @Override RestartStrategyInstance<T> newInstance(T restartable);  }