@Test
public void shouldFailReceiveEventWithLowerCounter() throws Exception {

  Event event = Event.started(INSTANCE);
  Optional<RunState> runState = Optional.of(
      RunState.create(INSTANCE, State.SUBMITTED, StateData.zero(), NOW.minusMillis(1), 17));
  when(transaction.readActiveState(INSTANCE)).thenReturn(runState);
  try {
    stateManager.receive(event, 18);
    fail();
  } catch (RuntimeException e) {
    assertThat(e.getMessage(), startsWith("Unexpected current counter is less than last observed one for"));
  }
  verify(storage, never()).writeEvent(any());
}