@Test
public void triggerShouldLogTransactionFailure() throws Exception {

  final TransactionException cause = new TransactionException(
      new DatastoreException(new IOException("netsplit!")));
  reset(storage);
  when(storage.getLatestStoredCounter(INSTANCE)).thenReturn(Optional.empty());
  when(storage.runInTransactionWithRetries(any())).thenThrow(cause);
  try {
    stateManager.trigger(INSTANCE, Trigger.natural(), PARAMETERS);
    fail();
  } catch (Exception ignore) {
  }
  verify(logger).debug("Transaction failure when triggering workflow instance: {}: {}",
      INSTANCE, cause.getMessage(), cause);
}