@Test
public void shouldFailToStoreNextNaturalTrigger() throws Exception {

  doThrow(new IOException("update error")).when(transaction)
      .storeWorkflowWithNextNaturalTrigger(any(), any());
  when(transaction.workflow(HOURLY_WORKFLOW.id()))
      .thenReturn(Optional.of(HOURLY_WORKFLOW));
  try {
    workflowInitializer.store(HOURLY_WORKFLOW_WITH_VALID_OFFSET, PASS);
    fail();
  } catch (RuntimeException e) {
    assertEquals("update error", e.getCause().getMessage());
  }
}