@Test void close() throws SQLException { when(sqlExecutor.connect()).thenReturn(connection); JdbcTransaction sut = new JdbcTransaction(sqlExecutor); sut.close(); verify(connection).setAutoCommit(false); verify(connection).rollback(); verify(connection).close(); verifyNoMoreInteractions(sqlExecutor, connection); }
@Override public void close() { rollback(); autoCloseable.close(); }
JdbcTransaction implements Transaction { @Override public void close() { rollback(); autoCloseable.close(); } }
JdbcTransaction implements Transaction { @Override public void close() { rollback(); autoCloseable.close(); } JdbcTransaction(JdbcSqlExecutor sqlExecutor); }
JdbcTransaction implements Transaction { @Override public void close() { rollback(); autoCloseable.close(); } JdbcTransaction(JdbcSqlExecutor sqlExecutor); @Override void commit(); @Override void rollback(); @Override List<T> query(String sql, Object[] args, RowMapper<T> rowMapper); @Override CompletableFuture<List<T>> queryAsync(String sql, Object[] args, RowMapper<T> rowMapper); @Override Stream<T> stream(String sql, Object[] args, RowMapper<T> rowMapper); @Override int update(String sql, Object[] args); @Override boolean execute(String sql, Object[] args); @Override CompletableFuture<Integer> updateAsync(String sql, Object[] args); @Override void close(); }
JdbcTransaction implements Transaction { @Override public void close() { rollback(); autoCloseable.close(); } JdbcTransaction(JdbcSqlExecutor sqlExecutor); @Override void commit(); @Override void rollback(); @Override List<T> query(String sql, Object[] args, RowMapper<T> rowMapper); @Override CompletableFuture<List<T>> queryAsync(String sql, Object[] args, RowMapper<T> rowMapper); @Override Stream<T> stream(String sql, Object[] args, RowMapper<T> rowMapper); @Override int update(String sql, Object[] args); @Override boolean execute(String sql, Object[] args); @Override CompletableFuture<Integer> updateAsync(String sql, Object[] args); @Override void close();  }