public QueueInfo[] getRootQueues() throws IOException, InterruptedException {
    try {
      return TypeConverter.fromYarnQueueInfo(client.getRootQueueInfos(),
          this.conf);
    } catch (YarnException e) {
      throw new IOException(e);
    }
  }
@Test
  public void testGetRootQueues() throws IOException, InterruptedException {
    final ApplicationClientProtocol applicationsManager = Mockito.mock(ApplicationClientProtocol.class);
    GetQueueInfoResponse response = Mockito.mock(GetQueueInfoResponse.class);
    org.apache.hadoop.yarn.api.records.QueueInfo queueInfo =
      Mockito.mock(org.apache.hadoop.yarn.api.records.QueueInfo.class);
    Mockito.when(response.getQueueInfo()).thenReturn(queueInfo);
    try {
      Mockito.when(applicationsManager.getQueueInfo(Mockito.any(
        GetQueueInfoRequest.class))).thenReturn(response);
    } catch (YarnException e) {
      throw new IOException(e);
    }

    ResourceMgrDelegate delegate = new ResourceMgrDelegate(
      new YarnConfiguration()) {
      @Override
      protected void serviceStart() throws Exception {
        Assert.assertTrue(this.client instanceof YarnClientImpl);
        ((YarnClientImpl) this.client).setRMClient(applicationsManager);
      }
    };
    delegate.getRootQueues();

    ArgumentCaptor<GetQueueInfoRequest> argument =
      ArgumentCaptor.forClass(GetQueueInfoRequest.class);
    try {
      Mockito.verify(applicationsManager).getQueueInfo(
        argument.capture());
    } catch (YarnException e) {
      throw new IOException(e);
    }

    Assert.assertTrue("Children of root queue not requested",
      argument.getValue().getIncludeChildQueues());
    Assert.assertTrue("Request wasn't to recurse through children",
      argument.getValue().getRecursive());
  }