@Test
public void shouldIssueInfoOnceIfRepeated() throws Exception {

  setResourceLimit("r1", 0);
  initWorkflow(workflowUsingResources(WORKFLOW_ID1, "r1"));
  when(shardedCounter.counterHasSpareCapacity("r1")).thenReturn(false);
  InOrder inOrder = Mockito.inOrder(stateManager);
  StateData stateDataWithoutInfo = StateData.newBuilder()
      .build();
  RunState rsWithoutInfo = RunState.create(INSTANCE_1, State.QUEUED, stateDataWithoutInfo, time.get(), 17);
  activeStates.put(INSTANCE_1, rsWithoutInfo);
  scheduler.tick();
  inOrder.verify(stateManager).listActiveInstances();
  inOrder.verify(stateManager).getActiveState(INSTANCE_1);
  inOrder.verify(stateManager).receiveIgnoreClosed(
      Event.info(INSTANCE_1, Message.info("Resource limit reached for: [r1]")),
      rsWithoutInfo.counter());
  StateData stateDataWithInfo = StateData.newBuilder()
      .addMessage(Message.info("Resource limit reached for: [r1]"))
      .build();
  activeStates.put(INSTANCE_1, RunState.create(INSTANCE_1, State.QUEUED, stateDataWithInfo, time.get()));
  scheduler.tick();
  inOrder.verify(stateManager).listActiveInstances();
  inOrder.verify(stateManager).getActiveState(INSTANCE_1);
  inOrder.verifyNoMoreInteractions();
}