@Test
public void shouldStopOnNonZeroMaxRetriesReached() {

  StateData data = data(400, MAX_RETRY_COST, Optional.of(1));
  RunState maxedTerm = RunState.create(WORKFLOW_INSTANCE, TERMINATED, data, NOW, COUNTER);
  terminationHandler.transitionInto(maxedTerm, eventRouter);
  verify(eventRouter).receiveIgnoreClosed(Event.stop(WORKFLOW_INSTANCE), COUNTER);
}