@Test (timeout = 5000)
public void testRunCommandwithPriority() throws Exception {

  Configuration conf = new Configuration();
  conf.setInt(YarnConfiguration.NM_CONTAINER_EXECUTOR_SCHED_PRIORITY, 2);
  String[] command = ContainerExecutor.getRunCommand("echo", "group1", conf);
  if (Shell.WINDOWS) {
    // windows doesn't currently support
    assertEquals("first command should be the run command for the platform", 
             Shell.WINUTILS, command[0]); 
  } else {
    assertEquals("first command should be nice", "nice", command[0]); 
    assertEquals("second command should be -n", "-n", command[1]); 
    assertEquals("third command should be the priority", Integer.toString(2),
                 command[2]); 
  }
  // test with negative number
  conf.setInt(YarnConfiguration.NM_CONTAINER_EXECUTOR_SCHED_PRIORITY, -5);
  command = ContainerExecutor.getRunCommand("echo", "group1", conf);
  if (Shell.WINDOWS) {
    // windows doesn't currently support
    assertEquals("first command should be the run command for the platform", 
             Shell.WINUTILS, command[0]); 
  } else {
    assertEquals("first command should be nice", "nice", command[0]); 
    assertEquals("second command should be -n", "-n", command[1]); 
    assertEquals("third command should be the priority", Integer.toString(-5),
                  command[2]); 
  }
}