@Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
          r.writestate.writesEnabled = false;
          return invocation.callRealMethod();
        }
Verify that you can stop a long-running compaction (used during RS shutdown)
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompaction.java