@Test
public void testDefaultRuleInitializesProperlyWhenPolicyNotConfigured()
    throws IOException {

  // This test verifies if default rule in queue placement policy
  // initializes properly when policy is not configured and
  // undeclared pools is not allowed.
  conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
  conf.setBoolean(FairSchedulerConfiguration.ALLOW_UNDECLARED_POOLS, false);
  // Create an alloc file with no queue placement policy
  PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
  out.println("<?xml version=\"1.0\"?>");
  out.println("<allocations>");
  out.println("</allocations>");
  out.close();
  scheduler.init(conf);
  scheduler.start();
  scheduler.reinitialize(conf, resourceManager.getRMContext());
  List<QueuePlacementRule> rules = scheduler.allocConf.placementPolicy
      .getRules();
  for (QueuePlacementRule rule : rules) {
    if (rule instanceof Default) {
      Default defaultRule = (Default) rule;
      assertNotNull(defaultRule.defaultQueueName);
    }
  }
}