@Test
  public void testLocalHBaseCluster() throws Exception {
    // Set Master class and RegionServer class, and use default values for other options.
    StartTestingClusterOption option = StartTestingClusterOption.builder()
      .masterClass(MyHMaster.class).rsClass(MyHRegionServer.class).build();
    TEST_UTIL.startMiniCluster(option);
    // Can we cast back to our master class?
    try {
      int val = ((MyHMaster) TEST_UTIL.getHBaseCluster().getMaster(0)).echo(42);
      assertEquals(42, val);
    } catch (ClassCastException e) {
      fail("Could not cast master to our class");
    }
    // Can we cast back to our regionserver class?
    try {
      int val = ((MyHRegionServer) TEST_UTIL.getHBaseCluster().getRegionServer(0)).echo(42);
      assertEquals(42, val);
    } catch (ClassCastException e) {
      fail("Could not cast regionserver to our class");
    }
    TEST_UTIL.shutdownMiniCluster();
  }
Check that we can start a local HBase cluster specifying a custom master and regionserver class
and then cast back to those classes; also that the cluster will launch and terminate cleanly.
See HBASE-6011. Uses the HBaseTestingUtility facilities for creating a LocalHBaseCluster with
custom master and regionserver classes.
hbase-server/src/test/java/org/apache/hadoop/hbase/TestLocalHBaseCluster.java