@Test
  public void testNegativeMemstoreSize() throws IOException, InterruptedException {
    boolean IOEthrown = false;
    Table table = null;
    try {
      table = TEST_UTIL.getConnection().getTable(TableName.valueOf(tableName));

      // Adding data
      Put put1 = new Put(Bytes.toBytes("row1"));
      put1.addColumn(family, qualifier, Bytes.toBytes("Value1"));
      table.put(put1);
      Put put2 = new Put(Bytes.toBytes("row2"));
      put2.addColumn(family, qualifier, Bytes.toBytes("Value2"));
      table.put(put2);
      table.put(put2);
    } catch (IOException e) {
      IOEthrown = true;
    } finally {
      Assert.assertFalse("Shouldn't have thrown an exception", IOEthrown);
      if (table != null) {
        table.close();
      }
    }
  }
Test that verifies we do not have memstore size negative when a postPut/Delete hook is
slow/expensive and a flush is triggered at the same time the coprocessow is doing its work. To
simulate this we call flush from the coprocessor itself
hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestNegativeMemStoreSizeWithSlowCoprocessor.java