@Test
  public void testConfigurePartitioner() throws Exception {
    util.startMiniDFSCluster(1);
    try {
      Configuration conf = util.getConfiguration();
      // Create a user who is not the current user
      String fooUserName = "foo1234";
      String fooGroupName = "group1";
      UserGroupInformation ugi =
        UserGroupInformation.createUserForTesting(fooUserName, new String[] { fooGroupName });
      // Get user's home directory
      Path fooHomeDirectory = ugi.doAs(new PrivilegedAction<Path>() {
        @Override
        public Path run() {
          try (FileSystem fs = FileSystem.get(conf)) {
            return fs.makeQualified(fs.getHomeDirectory());
          } catch (IOException ioe) {
            LOG.error("Failed to get foo's home directory", ioe);
          }
          return null;
        }
      });
      // create the home directory and chown
      FileSystem fs = FileSystem.get(conf);
      fs.mkdirs(fooHomeDirectory);
      fs.setOwner(fooHomeDirectory, fooUserName, fooGroupName);

      Job job = Mockito.mock(Job.class);
      Mockito.doReturn(conf).when(job).getConfiguration();
      ImmutableBytesWritable writable = new ImmutableBytesWritable();
      List<ImmutableBytesWritable> splitPoints = new ArrayList<ImmutableBytesWritable>();
      splitPoints.add(writable);

      ugi.doAs(new PrivilegedAction<Void>() {
        @Override
        public Void run() {
          try {
            HFileOutputFormat2.configurePartitioner(job, splitPoints, false);
          } catch (IOException ioe) {
            LOG.error("Failed to configure partitioner", ioe);
          }
          return null;
        }
      });
      // verify that the job uses TotalOrderPartitioner
      verify(job).setPartitionerClass(TotalOrderPartitioner.class);
      // verify that TotalOrderPartitioner.setPartitionFile() is called.
      String partitionPathString = conf.get("mapreduce.totalorderpartitioner.path");
      Assert.assertNotNull(partitionPathString);
      // Make sure the partion file is in foo1234's home directory, and that
      // the file exists.
      Assert.assertTrue(partitionPathString.startsWith(fooHomeDirectory.toString()));
      Assert.assertTrue(fs.exists(new Path(partitionPathString)));
    } finally {
      util.shutdownMiniDFSCluster();
    }
  }
This test is to test the scenario happened in HBASE-6901. All files are bulk loaded and
excluded from minor compaction. Without the fix of HBASE-6901, an
ArrayIndexOutOfBoundsException will be thrown.
hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat2.java