@Test
public void testMountController() throws IOException {

  File parentDir = new File(tmpPath);
  File cgroup = new File(parentDir, controller.getName());
  assertTrue("cgroup dir should be cerated", cgroup.mkdirs());
  //Since we enabled (deferred) cgroup controller mounting, no interactions
  //should have occurred, with this mock
  verifyZeroInteractions(privilegedOperationExecutorMock);
  File emptyMtab = createEmptyCgroups();
  try {
    CGroupsHandler cGroupsHandler = new CGroupsHandlerImpl(
        createMountConfiguration(),
        privilegedOperationExecutorMock,
        emptyMtab.getAbsolutePath());
    PrivilegedOperation expectedOp = new PrivilegedOperation(
        PrivilegedOperation.OperationType.MOUNT_CGROUPS);
    //This is expected to be of the form :
    //net_cls=<mount_path>/net_cls
    String controllerKV = controller.getName() + "=" + tmpPath
        + Path.SEPARATOR + controller.getName();
    expectedOp.appendArgs(hierarchy, controllerKV);
    cGroupsHandler.initializeCGroupController(controller);
    try {
      ArgumentCaptor<PrivilegedOperation> opCaptor = ArgumentCaptor.forClass(
          PrivilegedOperation.class);
      verify(privilegedOperationExecutorMock)
          .executePrivilegedOperation(opCaptor.capture(), eq(false));
      //we'll explicitly capture and assert that the
      //captured op and the expected op are identical.
      Assert.assertEquals(expectedOp, opCaptor.getValue());
      verifyNoMoreInteractions(privilegedOperationExecutorMock);
      //Try mounting the same controller again - this should be a no-op
      cGroupsHandler.initializeCGroupController(controller);
      verifyNoMoreInteractions(privilegedOperationExecutorMock);
    } catch (PrivilegedOperationException e) {
      LOG.error("Caught exception: " + e);
      assertTrue("Unexpected PrivilegedOperationException from mock!",
          false);
    }
  } catch (ResourceHandlerException e) {
    LOG.error("Caught exception: " + e);
    assertTrue("Unexpected ResourceHandler Exception!", false);
  }
}