@Test
public void shouldTransitionIntoFailedIfStorageError() throws Exception {

  var workflow = Workflow.create("id", workflowConfiguration("--date", "{}", "--bar"));
  var workflowInstance = WorkflowInstance.create(workflow.id(), "2016-03-14");
  var exception = new IOException("TEST");
  when(storage.workflowWithState(workflow.id())).thenThrow(exception);
  RunState runState = RunState.create(workflowInstance, PREPARE, NOW, COUNTER);
  toTest.transitionInto(runState, eventRouter);
  verify(eventRouter).receive(Event.runError(workflowInstance, exception.getMessage()), COUNTER);
}