@Test
  public void testStopped() throws Exception {
    // shutdown hbase only. then check flag file.
    SingleProcessHBaseCluster cluster = UTIL.getHBaseCluster();
    LOG.info("shutdown hbase cluster...");
    cluster.shutdown();
    LOG.info("wait for the hbase cluster shutdown...");
    cluster.waitUntilShutDown();

    Configuration conf = UTIL.getConfiguration();
    FileSystem fs = FileSystem.get(conf);

    Path resultFile = new Path(UTIL.getDataTestDirOnTestFS(), MASTER_FILE);
    assertTrue("Master flag file should have been created", fs.exists(resultFile));

    resultFile = new Path(UTIL.getDataTestDirOnTestFS(), REGIONSERVER_FILE);
    assertTrue("RegionServer flag file should have been created", fs.exists(resultFile));
  }
Tests for master and regionserver coprocessor stop method
hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorStop.java