@Test
public void receiveShouldHandleOutputHandlerThrowingStateTransitionConflict() throws Exception {

  Optional<RunState> runState = Optional.of(
      RunState.create(INSTANCE, State.QUEUED, StateData.zero(), NOW.minusMillis(1), 17));
  when(transaction.readActiveState(INSTANCE)).thenReturn(runState);
  final StateTransitionConflictException rootCause = new StateTransitionConflictException("conflict!");
  doThrow(rootCause).when(outputHandler).transitionInto(any(), any());
  stateManager.receive(Event.dequeue(INSTANCE, ImmutableSet.of()));
  verify(logger).debug("State transition conflict when invoking output handler: {}", INSTANCE, rootCause);
}