@Test
public void shouldBeRateLimiting() {

  when(rateLimiter.acquire()).thenReturn(1.0);
  setResourceLimit("r1", 2);
  initWorkflow(workflowUsingResources(WORKFLOW_ID1, "r1"));
  populateActiveStates(RunState.create(INSTANCE_1, State.QUEUED, time.get()));
  scheduler.tick();
  verify(stats).recordResourceUsed("r1", 0L);
  verify(stateManager).receiveIgnoreClosed(
      eq(Event.dequeue(INSTANCE_1, ImmutableSet.of("r1"))), anyLong());
  verify(rateLimiter).acquire();
}