@Test
  public void testAfterCommitFailedOnThrowOOM() throws Exception {
    installCacheListenerAndWriter();

    // install TransactionWriter
    txMgr.setWriter(new TransactionWriter() {
      @Override
      public void beforeCommit(TransactionEvent event) throws TransactionWriterException {
        throw new OutOfMemoryError("this is expected!");
      }

      @Override
      public void close() {}
    });

    installTransactionListener();

    try {
      SystemFailureTestHook.setExpectedFailureClass(OutOfMemoryError.class);

      txMgr.begin();
      region.create("key1", "value1");
      cbCount = 0;
      try {
        txMgr.commit();
        fail("Commit should have thrown OOME");
      } catch (OutOfMemoryError expected) {
        // this is what we expect
      }

      // no callbacks were invoked
      assertEquals(0, cbCount);
      assertEquals(0, failedCommits);
      assertEquals(0, afterCommits);
      assertEquals(0, afterRollbacks);
    } finally {
      SystemFailureTestHook.setExpectedFailureClass(null);
    }
  }
Extracted from TXWriterJUnitTest. The OOME is problematic and causes the test suite to fail due
to suspect strings from SystemFailure Watchdog sending output to STDERR.
geode-core/src/integrationTest/java/org/apache/geode/TXWriterOOMEJUnitTest.java