public FSLeafQueue getLeafQueue(String name, boolean create) {
    return getLeafQueue(name, create, null, true);
  }
@Test
  public void testReloadTurnsLeafQueueIntoParent() {
    updateConfiguredLeafQueues(queueManager, "queue1");
    
    // When no apps are running in the leaf queue, should be fine turning it
    // into a parent.
    updateConfiguredLeafQueues(queueManager, "queue1.queue2");
    assertNull(queueManager.getLeafQueue("queue1", false));
    assertNotNull(queueManager.getLeafQueue("queue1.queue2", false));
    
    // When leaf queues are empty, should be ok deleting them and
    // turning parent into a leaf.
    updateConfiguredLeafQueues(queueManager, "queue1");
    assertNull(queueManager.getLeafQueue("queue1.queue2", false));
    assertNotNull(queueManager.getLeafQueue("queue1", false));
    
    // When apps exist in leaf queue, we shouldn't be able to create
    // children under it, but things should work otherwise.
    FSLeafQueue q1 = queueManager.getLeafQueue("queue1", false);
    ApplicationId appId = ApplicationId.newInstance(0, 0);
    q1.addAssignedApp(appId);
    updateConfiguredLeafQueues(queueManager, "queue1.queue2");
    assertNull(queueManager.getLeafQueue("queue1.queue2", false));
    assertNotNull(queueManager.getLeafQueue("queue1", false));
    
    // When apps exist in leaf queues under a parent queue, shouldn't be
    // able to turn it into a leaf queue, but things should work otherwise.
    q1.removeAssignedApp(appId);
    updateConfiguredLeafQueues(queueManager, "queue1.queue2");
    FSLeafQueue q2 = queueManager.getLeafQueue("queue1.queue2", false);
    q2.addAssignedApp(appId);
    updateConfiguredLeafQueues(queueManager, "queue1");
    assertNotNull(queueManager.getLeafQueue("queue1.queue2", false));
    assertNull(queueManager.getLeafQueue("queue1", false));
    
    // Since YARN-7769 FS doesn't create the default queue during init, so
    // it should be possible to create a queue under the root.default queue
    updateConfiguredLeafQueues(queueManager, "default.queue3");
    assertNotNull(queueManager.getLeafQueue("default.queue3", false));
    assertNull(queueManager.getLeafQueue("default", false));
  }