@Test
public void testRemount()
    throws Exception {

  // Initialize mount point
  File parentDir = new File(tmpPath);
  final String oldMountPointDir = "oldmount";
  final String newMountPointDir = "newmount";
  File oldMountPoint = new File(parentDir, oldMountPointDir);
  File mtab = createPremountedCgroups(
      oldMountPoint, true);
  File newMountPoint = new File(parentDir, newMountPointDir);
  assertTrue("Could not create dirs",
      new File(newMountPoint, "cpu").mkdirs());
  // Initialize YARN classes
  Configuration confMount = createMountConfiguration();
  confMount.set(YarnConfiguration.NM_LINUX_CONTAINER_CGROUPS_MOUNT_PATH,
      parentDir.getAbsolutePath() + Path.SEPARATOR + newMountPointDir);
  CGroupsHandlerImpl cGroupsHandler = new CGroupsHandlerImpl(confMount,
      privilegedOperationExecutorMock, mtab.getAbsolutePath());
  cGroupsHandler.initializeCGroupController(
      CGroupsHandler.CGroupController.CPU);
  ArgumentCaptor<PrivilegedOperation> opCaptor = ArgumentCaptor.forClass(
      PrivilegedOperation.class);
  verify(privilegedOperationExecutorMock)
      .executePrivilegedOperation(opCaptor.capture(), eq(false));
  File hierarchyFile =
      new File(new File(newMountPoint, "cpu"), this.hierarchy);
  assertTrue("Yarn cgroup should exist", hierarchyFile.exists());
}