PoolUtil { public static SQLException generateSQLException(String reason, Throwable t) { try { if (sqlExceptionClass == null){ sqlExceptionClass = (Class<Throwable>) Class.forName(exceptionClass); } return (SQLException)sqlExceptionClass.getConstructor(String.class, Throwable.class).newInstance(reason, t); } catch (Exception e) { return new SQLException(PoolUtil.stringifyException(t)); } }  static String fillLogParams(String sql, Map<Object, Object> logParams); static String stringifyException(Throwable t); static SQLException generateSQLException(String reason, Throwable t);  }
@Test public void testGenerateException(){ assertNotNull(PoolUtil.generateSQLException("foo", new SQLException())); PoolUtil.sqlExceptionClass = Throwable.class; assertNotNull(PoolUtil.generateSQLException("foo", new SQLException())); }