   @Test
   public void testCleanup() throws Exception {


      // by default we only have space for 2 completed tasks, but we're going to start 10
      testWithMaxFinishedSize(10, 2);

      queue.gracefulShutdown(false);

      // now make a new queue with space for 10 completed tasks
      queue = new TaskQueueImpl(
            "testQueue",
            3,
            Suppliers.ofInstance(3),   // 3 concurrent tasks
            Suppliers.ofInstance(10)    // 2 finished tasks
      );

      testWithMaxFinishedSize(10, 10);

      queue.gracefulShutdown(false);

      // make another queue, and try to clean it up
      // before anything happens, just to make sure
      // we don't error
      queue = new TaskQueueImpl(
            "testQueue",
            3,
            Suppliers.ofInstance(3),   // 3 concurrent tasks
            Suppliers.ofInstance(10)    // 2 finished tasks
      );
      queue.cleanup();

      assertTrue(0 == factory.resetNumEventsFired());
   }