@Test public void testCreateSavepoint() throws Exception { assertNull(createSavepoint(null)); Connection c = mock(Connection.class); Savepoint savepoint = mock(Savepoint.class); when(c.getAutoCommit()).thenReturn(true); assertNull(createSavepoint(c)); when(c.getAutoCommit()).thenReturn(false); when(c.setSavepoint()).thenReturn(savepoint); assertNotNull(createSavepoint(c)); try { doThrow(new SQLException("Expected")).when(c).setSavepoint(); createSavepoint(c); fail(); } catch (SQLException expected) { } }
public static Savepoint createSavepoint(Connection sqlConnection) throws SQLException { if (sqlConnection == null) { return null; } if (!sqlConnection.getAutoCommit()) { return sqlConnection.setSavepoint(); } return null; }
JdbcUtil { public static Savepoint createSavepoint(Connection sqlConnection) throws SQLException { if (sqlConnection == null) { return null; } if (!sqlConnection.getAutoCommit()) { return sqlConnection.setSavepoint(); } return null; } }
JdbcUtil { public static Savepoint createSavepoint(Connection sqlConnection) throws SQLException { if (sqlConnection == null) { return null; } if (!sqlConnection.getAutoCommit()) { return sqlConnection.setSavepoint(); } return null; }  }
JdbcUtil { public static Savepoint createSavepoint(Connection sqlConnection) throws SQLException { if (sqlConnection == null) { return null; } if (!sqlConnection.getAutoCommit()) { return sqlConnection.setSavepoint(); } return null; }  static void closeQuietly(AutoCloseable... closeables); static void rollback(Savepoint svp, Connection sqlConnection); static void rollback(Connection sqlConnection); static void commit(Connection sqlConnection); static Savepoint createSavepoint(Connection sqlConnection); static Connection testConnection(Connection sqlConnection, String testStatement, boolean debugMode); static Properties mergeConnectionProperties(Properties p, String username, String password); static Connection getConnection(AdaptrisMessage msg, AdaptrisConnection adpCon); static void rollback(Connection sqlConnection, AdaptrisMessage msg); static void commit(Connection sqlConnection, AdaptrisMessage msg); }
JdbcUtil { public static Savepoint createSavepoint(Connection sqlConnection) throws SQLException { if (sqlConnection == null) { return null; } if (!sqlConnection.getAutoCommit()) { return sqlConnection.setSavepoint(); } return null; }  static void closeQuietly(AutoCloseable... closeables); static void rollback(Savepoint svp, Connection sqlConnection); static void rollback(Connection sqlConnection); static void commit(Connection sqlConnection); static Savepoint createSavepoint(Connection sqlConnection); static Connection testConnection(Connection sqlConnection, String testStatement, boolean debugMode); static Properties mergeConnectionProperties(Properties p, String username, String password); static Connection getConnection(AdaptrisMessage msg, AdaptrisConnection adpCon); static void rollback(Connection sqlConnection, AdaptrisMessage msg); static void commit(Connection sqlConnection, AdaptrisMessage msg);  }