@Test
public void shouldWriteActiveStateOnEvent() throws Exception {

  Optional<RunState> runState = Optional.of(
      RunState.create(INSTANCE, State.QUEUED, StateData.zero(), NOW, 17));
  when(transaction.readActiveState(INSTANCE)).thenReturn(runState);
  stateManager.receive(Event.dequeue(INSTANCE, ImmutableSet.of()));
  verify(transaction).updateActiveState(INSTANCE, RunState.create(INSTANCE, State.PREPARE,
      StateData.newBuilder().resourceIds(ImmutableSet.of()).build(), NOW, 18));
}