@Test
public void shouldHandleResourceUsageExceededLookupFailure() throws Exception {

  setResourceLimit("r1", 2);
  initWorkflow(workflowUsingResources(WORKFLOW_ID1, "r1"));
  when(shardedCounter.counterHasSpareCapacity("r1")).thenThrow(new RuntimeException("error!"));
  final WorkflowInstance i0 = instance(WORKFLOW_ID1, "i0");
  final RunState rs0 = RunState.create(i0, State.QUEUED, time.get(), 17);
  populateActiveStates(rs0);
  scheduler.tick();
  verify(shardedCounter, times(1)).counterHasSpareCapacity("r1");
  verify(stateManager).receiveIgnoreClosed(Event.dequeue(i0, ImmutableSet.of("r1")), 17);
}