@Test
public void testValidateCSConfigInvalidQueueDeletion() {

  Configuration oldConfig = CapacitySchedulerConfigGeneratorForTest
          .createBasicCSConfiguration();
  Configuration newConfig = new Configuration(oldConfig);
  newConfig.set("yarn.scheduler.capacity.root.queues", "test1");
  newConfig.set("yarn.scheduler.capacity.root.test1.capacity", "100");
  newConfig.unset("yarn.scheduler.capacity.root.test2.maximum-capacity");
  newConfig.unset("yarn.scheduler.capacity.root.test2.state");
  newConfig.set("yarn.scheduler.capacity.queue-mappings",
          "u:test1:test1");
  RMContext rmContext = prepareRMContext();
  try {
    CapacitySchedulerConfigValidator
            .validateCSConfiguration(oldConfig, newConfig, rmContext);
    fail("Invalid capacity for children of queue root");
  } catch (IOException e) {
    Assert.assertTrue(e.getCause().getMessage()
            .contains("root.test2 cannot be deleted"));
    Assert.assertTrue(e.getCause().getMessage()
            .contains("the queue is not yet in stopped state"));
  }
}