@Test
public void receiveShouldPropagateOutputHandlerException() 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 RuntimeException rootCause = new RuntimeException("foo!");
  doThrow(rootCause).when(outputHandler).transitionInto(any(), any());
  try {
    stateManager.receive(Event.dequeue(INSTANCE, ImmutableSet.of()));
    fail();
  } catch (Exception e) {
    assertThat(Throwables.getRootCause(e), is(rootCause));
  }
}