@Test
  public void testBadConnection() throws Exception {
    Configuration conf = MetastoreConf.newMetastoreConf();
    MetastoreConf.setVar(conf, MetastoreConf.ConfVars.CONNECT_URL_KEY, "blah");
    RuntimeException e = null;
    try {
      TxnUtils.getTxnStore(conf);
    }
    catch(RuntimeException ex) {
      LOG.info("Expected error: " + ex.getMessage(), ex);
      e = ex;
    }
    assertNotNull(e);
    assertTrue(
        e.getMessage().contains("No suitable driver found for blah")
        || e.getMessage().contains("Failed to get driver instance for jdbcUrl=blah")
    );
  }
this intentionally sets a bad URL for connection to test error handling logic
in TxnHandler
@throws Exception
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/txn/TestTxnHandlerNegative.java