@Test
public void shouldFailIfGuardFails()
    throws IOException, WorkflowInitializationException {

  when(transaction.workflow(HOURLY_WORKFLOW.id())).thenReturn(Optional.of(HOURLY_WORKFLOW));
  final RuntimeException cause = new RuntimeException("fail!");
  try {
    workflowInitializer.store(HOURLY_WORKFLOW, wf -> { throw cause; });
  } catch (RuntimeException e) {
    assertThat(e, is(cause));
  }
  verify(transaction).workflow(HOURLY_WORKFLOW.id());
  verifyNoMoreInteractions(transaction);
}