@Test void connection() throws SQLException { when(sqlExecutor.connect()).thenReturn(connection); JdbcTransaction sut = new JdbcTransaction(sqlExecutor); Connection result = sut.connection(); assertThat(result, sameInstance(connection)); verify(connection).setAutoCommit(false); verifyNoMoreInteractions(sqlExecutor, connection); }
Connection connection() { return connection; }
JdbcTransaction implements Transaction { Connection connection() { return connection; } }
JdbcTransaction implements Transaction { Connection connection() { return connection; } JdbcTransaction(JdbcSqlExecutor sqlExecutor); }
JdbcTransaction implements Transaction { Connection connection() { return connection; } 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 { Connection connection() { return connection; } 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();  }