@Test
public void shouldCacheResourceUsageExceededLookup() throws Exception {

  setResourceLimit("r1", 2);
  initWorkflow(workflowUsingResources(WORKFLOW_ID1, "r1"));
  when(shardedCounter.counterHasSpareCapacity("r1")).thenReturn(false);
  final WorkflowInstance i0 = instance(WORKFLOW_ID1, "i0");
  final WorkflowInstance i1 = instance(WORKFLOW_ID1, "i1");
  final RunState rs0 = RunState.create(i0, State.QUEUED, time.get(), 17);
  final RunState rs1 = RunState.create(i1, State.QUEUED, time.get(), 4711);
  populateActiveStates(rs0);
  populateActiveStates(rs1);
  scheduler.tick();
  verify(shardedCounter, times(1)).counterHasSpareCapacity("r1");
  verifyNoMoreInteractions(shardedCounter);
}