예제 #1
0
  @Test
  public void testFixedDelayRestartStrategy() {
    int numberRestarts = 10;
    long restartDelay = 10;

    FixedDelayRestartStrategy fixedDelayRestartStrategy =
        new FixedDelayRestartStrategy(numberRestarts, restartDelay);

    ExecutionGraph executionGraph = mock(ExecutionGraph.class);
    when(executionGraph.getFutureExecutor())
        .thenReturn(ExecutionContext$.MODULE$.fromExecutor(MoreExecutors.directExecutor()));

    while (fixedDelayRestartStrategy.canRestart()) {
      fixedDelayRestartStrategy.restart(executionGraph);
    }

    Mockito.verify(executionGraph, Mockito.times(numberRestarts)).restart();
  }