Skip to content

Instantly share code, notes, and snippets.

@dbazile
Last active March 8, 2021 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbazile/0511fd3a0866c52d5bb86c3052e42385 to your computer and use it in GitHub Desktop.
Save dbazile/0511fd3a0866c52d5bb86c3052e42385 to your computer and use it in GitHub Desktop.
A test mock harness for Jdbi 3. Hideous and potentially brittle but it works (probably).
/*
* Versions:
* JDK 11, Jdbi 3.16.0, Mockito 3.6.28
*/
package bazile;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.Date;
import java.sql.NClob;
import java.sql.ParameterMetaData;
import java.sql.PreparedStatement;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.RowId;
import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Statement;
import java.sql.Struct;
import java.sql.Time;
import java.sql.Timestamp;
import java.sql.Types;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.stream.Collectors;
import org.jdbi.v3.core.Handle;
import org.jdbi.v3.core.Jdbi;
import org.jdbi.v3.core.generic.GenericType;
import org.jdbi.v3.core.mapper.reflect.ConstructorMapper;
import org.jdbi.v3.core.spi.JdbiPlugin.Singleton;
import org.jdbi.v3.core.statement.Query;
import org.jdbi.v3.core.statement.StatementBuilder;
import org.jdbi.v3.core.statement.StatementContext;
import org.jdbi.v3.core.statement.Update;
import org.jdbi.v3.sqlobject.SqlObjectPlugin;
import org.jdbi.v3.sqlobject.customizer.Bind;
import org.jdbi.v3.sqlobject.customizer.BindBean;
import org.jdbi.v3.sqlobject.statement.SqlQuery;
import org.jdbi.v3.sqlobject.statement.SqlUpdate;
import org.junit.jupiter.api.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
class MainTest {
public static final GenericType<Collection<String>> T_STRING_COLLECTION = new GenericType<>() {
};
@Test
void testImperativeBinding() throws SQLException {
//
// Mock Only
//
System.out.println(
JdbiMock.query(Map.of("col1", "lorem ipsum", "col2", 1))
.open()
.createQuery("SELECT 1 FROM stuff WHERE data IN (:string, :int, :instant, :set)")
.bind("string", "bar")
.bind("int", 5)
.bind("instant", Instant.now())
.bindByType("set", Set.of("baz", "qux"), T_STRING_COLLECTION)
.mapToMap()
.one()
);
System.out.println(
JdbiMock.update(5)
.open()
.createUpdate("DELETE FROM stuff WHERE :foo=1")
.bind("foo", "bar")
.execute()
);
//
// Mock and Verify
//
final JdbiMock mock = JdbiMock.create()
.appendQuery(Map.of("1", 1))
.appendUpdate(999);
final Jdbi jdbi = mock.getJdbi();
System.out.println(
jdbi.open()
.createQuery("SELECT 1 FROM stuff WHERE 1 IN (:string, :int, :int_boxed, :instant, :byte, :byte_boxed, :bytes, :bool, :bool_boxed, :char, :char_boxed, :set) AND 2 IN <list>")
.bind("string", "test-string")
.bind("int", 5)
.bind("int_boxed", Integer.valueOf(5))
.bind("instant", Instant.parse("2021-03-08T00:00:00Z"))
.bind("byte", (byte) 1)
.bind("byte_boxed", Byte.valueOf((byte) 1))
.bind("bytes", new byte[]{0, 1})
.bind("bool", true)
.bind("bool_boxed", Boolean.TRUE)
.bind("char", 'a')
.bind("char_boxed", Character.valueOf('Z'))
.bindByType("set", Set.of("baz", "qux"), T_STRING_COLLECTION)
.bindList("list", List.of("baz", "qux"))
.mapToMap()
.one()
);
System.out.println(mock.getQueryParams(0));
System.out.println(
jdbi.open()
.createUpdate("INSERT INTO stuff (data) VALUES (:data)")
.bind("data", "bar")
.execute()
);
System.out.println(mock.getUpdateParams(0));
}
interface ExampleDao {
@SqlQuery("SELECT foo, bar FROM example")
List<Example> list();
@SqlUpdate("INSERT INTO example (foo, bar) VALUES (:foo, :bar)")
void create(@BindBean Example example);
}
public static class Example {
private final String foo;
private final String bar;
public Example(String foo, String bar) {
this.foo = foo;
this.bar = bar;
}
public String getFoo() {
return foo;
}
public String getBar() {
return bar;
}
}
@Test
void testDeclarative() {
final JdbiMock mock = JdbiMock.create();
mock.appendQuery(Map.of("foo", "test-foo", "bar", "test-bar"));
final Jdbi jdbi = mock.getJdbi();
jdbi.installPlugin(new SqlObjectPlugin());
jdbi.registerRowMapper(ConstructorMapper.factory(Example.class));
final List<Example> items = jdbi.withExtension(ExampleDao.class, dao -> dao.list());
assertEquals(1, items.size());
assertEquals("test-foo", items.get(0).getFoo());
assertEquals("test-bar", items.get(0).getBar());
jdbi.useExtension(ExampleDao.class, dao -> dao.create(new Example("lol", "wut")));
final Map<String, Object> params = mock.getUpdateParams(0);
assertEquals(Map.of("foo", "lol", "bar", "wut"), params);
}
private static class JdbiMock extends Singleton {
private final Jdbi jdbi;
private final List<List<Map<String, Object>>> queryResultsSequence;
private final QueryDelegate queryDelegate;
private final UpdateDelegate updateDelegate;
private final List<Integer> updateResultsSequence;
private final Connection connection;
public static JdbiMock create() {
return new JdbiMock();
}
@SafeVarargs
public static <T extends Map<String, Object>> Jdbi query(T row, T... rows) {
return create()
.appendQuery(row, rows)
.getJdbi();
}
public static Jdbi update(int affectedRows) {
return create()
.appendUpdate(affectedRows)
.getJdbi();
}
private JdbiMock() {
this.connection = new MockConnection();
this.queryResultsSequence = new ArrayList<>();
this.queryDelegate = new QueryDelegate(queryResultsSequence);
this.updateResultsSequence = new ArrayList<>();
this.updateDelegate = new UpdateDelegate(updateResultsSequence);
this.jdbi = Jdbi.create(this::getConnection);
// Configure JDBI
this.jdbi.installPlugin(this);
jdbi.registerArrayType(String.class, "VARCHAR");
}
@SafeVarargs
public final <T extends Map<String, Object>> JdbiMock appendQuery(T row, T... rows) {
final List<Map<String, Object>> combined = new ArrayList<>();
combined.add(row);
combined.addAll(List.of(rows));
queryResultsSequence.add(combined);
return this;
}
public JdbiMock appendUpdate(int affectedRows) {
updateResultsSequence.add(affectedRows);
return this;
}
@Override
public Handle customizeHandle(Handle handle) {
final Handle spy = spy(handle);
// Attach delegates
when(spy.createQuery(anyString())).thenAnswer(queryDelegate);
when(spy.createUpdate(anyString())).thenAnswer(updateDelegate);
return spy;
}
private Connection getConnection() {
return connection;
}
public Jdbi getJdbi() {
return jdbi;
}
public int getQueryCount() {
return queryDelegate.size();
}
public Map<String, Object> getQueryParams(int index) {
final int count = getQueryCount();
if (count == 0) {
throw new IndexOutOfBoundsException("no queries");
}
if (index < 0 || index >= count) {
throw new IndexOutOfBoundsException("index must be a number between 0 and " + count);
}
return queryDelegate.params(index);
}
public int getUpdateCount() {
return updateDelegate.size();
}
public Map<String, Object> getUpdateParams(int index) {
final int count = getUpdateCount();
if (count == 0) {
throw new IndexOutOfBoundsException("no updates");
}
if (index < 0 || index >= count) {
throw new IndexOutOfBoundsException("index must be a number between 0 and " + count);
}
return updateDelegate.params(index);
}
}
private static class QueryDelegate implements Answer<Query> {
private final List<Map<String, Object>> paramsSequence;
private final List<List<Map<String, Object>>> resultsSequence;
private int queryIndex = 0;
public QueryDelegate(List<List<Map<String, Object>>> resultsSequence) {
this.paramsSequence = new ArrayList<>();
this.resultsSequence = resultsSequence;
}
@Override
public Query answer(InvocationOnMock invocation) {
final Handle handle = (Handle) invocation.getMock();
final int i = queryIndex++;
final List<Map<String, Object>> rows = (i < resultsSequence.size())
? resultsSequence.get(i)
: Collections.emptyList();
final Map<String, Object> params = new HashMap<>();
paramsSequence.add(params);
when(handle.getStatementBuilder()).thenReturn(new MockedStatementBuilder(params, rows, -1));
return new Query(handle, invocation.getArgument(0, String.class));
}
public int size() {
return paramsSequence.size();
}
public Map<String, Object> params(int i) {
return paramsSequence.get(i);
}
}
private static class UpdateDelegate implements Answer<Update> {
private final List<Map<String, Object>> paramsSequence;
private final List<Integer> resultSequence;
private int updateIndex = 0;
public UpdateDelegate(List<Integer> resultSequence) {
this.resultSequence = resultSequence;
this.paramsSequence = new ArrayList<>();
}
@Override
public Update answer(InvocationOnMock invocation) {
final Handle handle = (Handle) invocation.getMock();
final int i = updateIndex++;
final Map<String, Object> params = new HashMap<>();
paramsSequence.add(params);
final int affectedRows = i < resultSequence.size() ? resultSequence.get(i) : 0;
when(handle.getStatementBuilder()).thenReturn(new MockedStatementBuilder(params, null, affectedRows));
return new Update(handle, invocation.getArgument(0, String.class));
}
public int size() {
return paramsSequence.size();
}
public Map<String, Object> params(int i) {
return paramsSequence.get(i);
}
}
private static class MockConnection implements Connection {
@Override
public Statement createStatement() throws SQLException {
throw new NotImplementedException();
}
@Override
public PreparedStatement prepareStatement(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public CallableStatement prepareCall(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public String nativeSQL(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setAutoCommit(boolean b) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean getAutoCommit() throws SQLException {
return true;
}
@Override
public void commit() throws SQLException {
throw new NotImplementedException();
}
@Override
public void rollback() throws SQLException {
throw new NotImplementedException();
}
@Override
public void close() throws SQLException {
// do nothing
}
@Override
public boolean isClosed() throws SQLException {
throw new NotImplementedException();
}
@Override
public DatabaseMetaData getMetaData() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setReadOnly(boolean b) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isReadOnly() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setCatalog(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public String getCatalog() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setTransactionIsolation(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getTransactionIsolation() throws SQLException {
throw new NotImplementedException();
}
@Override
public SQLWarning getWarnings() throws SQLException {
throw new NotImplementedException();
}
@Override
public void clearWarnings() throws SQLException {
throw new NotImplementedException();
}
@Override
public Statement createStatement(int i, int i1) throws SQLException {
throw new NotImplementedException();
}
@Override
public PreparedStatement prepareStatement(String s, int i, int i1) throws SQLException {
throw new NotImplementedException();
}
@Override
public CallableStatement prepareCall(String s, int i, int i1) throws SQLException {
throw new NotImplementedException();
}
@Override
public Map<String, Class<?>> getTypeMap() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setHoldability(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getHoldability() throws SQLException {
throw new NotImplementedException();
}
@Override
public Savepoint setSavepoint() throws SQLException {
throw new NotImplementedException();
}
@Override
public Savepoint setSavepoint(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public void rollback(Savepoint savepoint) throws SQLException {
throw new NotImplementedException();
}
@Override
public void releaseSavepoint(Savepoint savepoint) throws SQLException {
throw new NotImplementedException();
}
@Override
public Statement createStatement(int i, int i1, int i2) throws SQLException {
throw new NotImplementedException();
}
@Override
public PreparedStatement prepareStatement(String s, int i, int i1, int i2) throws SQLException {
throw new NotImplementedException();
}
@Override
public CallableStatement prepareCall(String s, int i, int i1, int i2) throws SQLException {
throw new NotImplementedException();
}
@Override
public PreparedStatement prepareStatement(String s, int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public PreparedStatement prepareStatement(String s, int[] ints) throws SQLException {
throw new NotImplementedException();
}
@Override
public PreparedStatement prepareStatement(String s, String[] strings) throws SQLException {
throw new NotImplementedException();
}
@Override
public Clob createClob() throws SQLException {
throw new NotImplementedException();
}
@Override
public Blob createBlob() throws SQLException {
throw new NotImplementedException();
}
@Override
public NClob createNClob() throws SQLException {
throw new NotImplementedException();
}
@Override
public SQLXML createSQLXML() throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isValid(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setClientInfo(String s, String s1) throws SQLClientInfoException {
throw new NotImplementedException();
}
@Override
public void setClientInfo(Properties properties) throws SQLClientInfoException {
throw new NotImplementedException();
}
@Override
public String getClientInfo(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public Properties getClientInfo() throws SQLException {
throw new NotImplementedException();
}
@Override
public Array createArrayOf(String s, Object[] objects) throws SQLException {
return new Array() {
@Override
public String getBaseTypeName() throws SQLException {
// HACK -- this won't always be the case, will it?
return s;
}
@Override
public int getBaseType() throws SQLException {
return Types.VARCHAR;
}
@Override
public Object getArray() throws SQLException {
return objects;
}
@Override
public Object getArray(Map<String, Class<?>> map) throws SQLException {
throw new NotImplementedException();
}
@Override
public Object getArray(long l, int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public Object getArray(long l, int i, Map<String, Class<?>> map) throws SQLException {
throw new NotImplementedException();
}
@Override
public ResultSet getResultSet() throws SQLException {
throw new NotImplementedException();
}
@Override
public ResultSet getResultSet(Map<String, Class<?>> map) throws SQLException {
throw new NotImplementedException();
}
@Override
public ResultSet getResultSet(long l, int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public ResultSet getResultSet(long l, int i, Map<String, Class<?>> map) throws SQLException {
throw new NotImplementedException();
}
@Override
public void free() throws SQLException {
}
};
}
@Override
public Struct createStruct(String s, Object[] objects) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setSchema(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public String getSchema() throws SQLException {
throw new NotImplementedException();
}
@Override
public void abort(Executor executor) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setNetworkTimeout(Executor executor, int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getNetworkTimeout() throws SQLException {
throw new NotImplementedException();
}
@Override
public <T> T unwrap(Class<T> aClass) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isWrapperFor(Class<?> aClass) throws SQLException {
throw new NotImplementedException();
}
}
private static class MockPreparedStatement implements PreparedStatement {
private final int affectedRows;
private final Connection connection;
private final Map<String, Object> params;
private final List<String> paramKeys;
private final MockedResultSet resultSet;
public MockPreparedStatement(Connection connection, Map<String, Object> params, List<String> paramKeys, MockedResultSet resultSet, int affectedRows) {
this.affectedRows = affectedRows;
this.connection = connection;
this.params = params; // Will mutate
this.paramKeys = List.copyOf(paramKeys);
this.resultSet = resultSet;
}
private void storeParam(int i, Object value) {
final String key = paramKeys.get(i - 1);
params.put(key, value);
}
@Override
public ResultSet executeQuery() throws SQLException {
throw new NotImplementedException();
}
@Override
public int executeUpdate() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setNull(int i, int value) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setBoolean(int i, boolean value) throws SQLException {
storeParam(i, value);
}
@Override
public void setByte(int i, byte value) throws SQLException {
storeParam(i, value);
}
@Override
public void setShort(int i, short value) throws SQLException {
storeParam(i, value);
}
@Override
public void setInt(int i, int value) throws SQLException {
storeParam(i, value);
}
@Override
public void setLong(int i, long value) throws SQLException {
storeParam(i, value);
}
@Override
public void setFloat(int i, float value) throws SQLException {
storeParam(i, value);
}
@Override
public void setDouble(int i, double value) throws SQLException {
storeParam(i, value);
}
@Override
public void setBigDecimal(int i, BigDecimal value) throws SQLException {
storeParam(i, value);
}
@Override
public void setString(int i, String value) throws SQLException {
storeParam(i, value);
}
@Override
public void setBytes(int i, byte[] value) throws SQLException {
storeParam(i, value);
}
@Override
public void setDate(int i, Date value) throws SQLException {
storeParam(i, value);
}
@Override
public void setTime(int i, Time value) throws SQLException {
storeParam(i, value);
}
@Override
public void setTimestamp(int i, Timestamp value) throws SQLException {
storeParam(i, value);
}
@Override
public void setAsciiStream(int i, InputStream inputStream, int i1) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setUnicodeStream(int i, InputStream inputStream, int i1) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setBinaryStream(int i, InputStream inputStream, int i1) throws SQLException {
throw new NotImplementedException();
}
@Override
public void clearParameters() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setObject(int i, Object o, int i1) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setObject(int i, Object value) throws SQLException {
storeParam(i, value);
}
@Override
public boolean execute() throws SQLException {
return true;
}
@Override
public void addBatch() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setCharacterStream(int i, Reader reader, int i1) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setRef(int i, Ref value) throws SQLException {
storeParam(i, value);
}
@Override
public void setBlob(int i, Blob value) throws SQLException {
storeParam(i, value);
}
@Override
public void setClob(int i, Clob value) throws SQLException {
storeParam(i, value);
}
@Override
public void setArray(int i, Array value) throws SQLException {
storeParam(i, value);
}
@Override
public ResultSetMetaData getMetaData() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setDate(int i, Date date, Calendar calendar) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setTime(int i, Time time, Calendar calendar) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setTimestamp(int i, Timestamp timestamp, Calendar calendar) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setNull(int i, int i1, String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setURL(int i, URL value) throws SQLException {
storeParam(i, value);
}
@Override
public ParameterMetaData getParameterMetaData() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setRowId(int i, RowId value) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setNString(int i, String value) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setNCharacterStream(int i, Reader reader, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setNClob(int i, NClob value) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setClob(int i, Reader reader, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setBlob(int i, InputStream inputStream, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setNClob(int i, Reader reader, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setSQLXML(int i, SQLXML value) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setObject(int i, Object o, int i1, int i2) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setAsciiStream(int i, InputStream inputStream, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setBinaryStream(int i, InputStream inputStream, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setCharacterStream(int i, Reader reader, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setAsciiStream(int i, InputStream value) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setBinaryStream(int i, InputStream value) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setCharacterStream(int i, Reader value) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setNCharacterStream(int i, Reader value) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setClob(int i, Reader value) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setBlob(int i, InputStream value) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setNClob(int i, Reader value) throws SQLException {
throw new NotImplementedException();
}
@Override
public ResultSet executeQuery(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public int executeUpdate(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public void close() throws SQLException {
throw new NotImplementedException();
}
@Override
public int getMaxFieldSize() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setMaxFieldSize(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getMaxRows() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setMaxRows(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public void setEscapeProcessing(boolean b) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getQueryTimeout() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setQueryTimeout(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public void cancel() throws SQLException {
throw new NotImplementedException();
}
@Override
public SQLWarning getWarnings() throws SQLException {
throw new NotImplementedException();
}
@Override
public void clearWarnings() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setCursorName(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean execute(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public ResultSet getResultSet() throws SQLException {
return resultSet;
}
@Override
public int getUpdateCount() throws SQLException {
return affectedRows;
}
@Override
public boolean getMoreResults() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setFetchDirection(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getFetchDirection() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setFetchSize(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getFetchSize() throws SQLException {
throw new NotImplementedException();
}
@Override
public int getResultSetConcurrency() throws SQLException {
throw new NotImplementedException();
}
@Override
public int getResultSetType() throws SQLException {
throw new NotImplementedException();
}
@Override
public void addBatch(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public void clearBatch() throws SQLException {
throw new NotImplementedException();
}
@Override
public int[] executeBatch() throws SQLException {
throw new NotImplementedException();
}
@Override
public Connection getConnection() throws SQLException {
return connection;
}
@Override
public boolean getMoreResults(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public ResultSet getGeneratedKeys() throws SQLException {
throw new NotImplementedException();
}
@Override
public int executeUpdate(String s, int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public int executeUpdate(String s, int[] ints) throws SQLException {
throw new NotImplementedException();
}
@Override
public int executeUpdate(String s, String[] strings) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean execute(String s, int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean execute(String s, int[] ints) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean execute(String s, String[] strings) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getResultSetHoldability() throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isClosed() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setPoolable(boolean b) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isPoolable() throws SQLException {
throw new NotImplementedException();
}
@Override
public void closeOnCompletion() throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isCloseOnCompletion() throws SQLException {
throw new NotImplementedException();
}
@Override
public <T> T unwrap(Class<T> aClass) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isWrapperFor(Class<?> aClass) throws SQLException {
throw new NotImplementedException();
}
}
private static class MockedStatementBuilder implements StatementBuilder {
private final int affectedRows;
private final Map<String, Object> params;
private final List<Map<String, Object>> rows;
public MockedStatementBuilder(Map<String, Object> params, List<Map<String, Object>> rows, int affectedRows) {
this.affectedRows = affectedRows;
this.params = params;
this.rows = rows;
}
@Override
public Statement create(Connection conn, StatementContext ctx) throws SQLException {
throw new NotImplementedException();
}
@Override
public PreparedStatement create(Connection conn, String sql, StatementContext ctx) throws SQLException {
final MockedResultSet resultSet = rows == null
? new MockedResultSet()
: new MockedResultSet(rows);
final List<String> paramKeys = ctx.getParsedSql().getParameters().getParameterNames();
return new MockPreparedStatement(conn, params, paramKeys, resultSet, affectedRows);
}
@Override
public CallableStatement createCall(Connection conn, String sql, StatementContext ctx) throws SQLException {
throw new NotImplementedException();
}
@Override
public void close(Connection conn, String sql, Statement stmt) throws SQLException {
// do nothing
}
@Override
public void close(Connection conn) {
throw new NotImplementedException();
}
}
private static class MockedResultSet implements ResultSet {
private final List<Map<String, Object>> rows;
private final List<String> columns;
private int rowIndex = -1;
// HACK -- if this is correct, wtf is the point even?
private boolean lastColumnReadWasNull;
public MockedResultSet(List<Map<String, Object>> rows) {
this.rows = List.copyOf(rows);
// HACK -- won't work for rs.get(int)
this.columns = rows.stream()
.flatMap(m -> m.keySet().stream())
.distinct()
.collect(Collectors.toList());
}
public MockedResultSet() {
this.rows = Collections.emptyList();
this.columns = Collections.emptyList();
}
private Object readColumn(int columnIndex) {
final String key = columns.get(columnIndex - 1);
final Object value = rows.get(rowIndex).get(key);
// Seriously, why?
lastColumnReadWasNull = value == null;
return value;
}
@Override
public boolean next() throws SQLException {
int nextRowIndex = rowIndex + 1;
if (nextRowIndex >= rows.size()) {
return false;
}
rowIndex = nextRowIndex;
return true;
}
@Override
public void close() throws SQLException {
// do nothing
}
@Override
public boolean wasNull() throws SQLException {
return lastColumnReadWasNull;
}
@Override
public String getString(int i) throws SQLException {
return readColumn(i).toString();
}
@Override
public boolean getBoolean(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public byte getByte(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public short getShort(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getInt(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public long getLong(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public float getFloat(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public double getDouble(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public BigDecimal getBigDecimal(int i, int i1) throws SQLException {
throw new NotImplementedException();
}
@Override
public byte[] getBytes(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public Date getDate(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public Time getTime(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public Timestamp getTimestamp(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public InputStream getAsciiStream(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public InputStream getUnicodeStream(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public InputStream getBinaryStream(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public String getString(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean getBoolean(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public byte getByte(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public short getShort(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getInt(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public long getLong(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public float getFloat(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public double getDouble(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public BigDecimal getBigDecimal(String s, int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public byte[] getBytes(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public Date getDate(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public Time getTime(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public Timestamp getTimestamp(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public InputStream getAsciiStream(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public InputStream getUnicodeStream(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public InputStream getBinaryStream(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public SQLWarning getWarnings() throws SQLException {
throw new NotImplementedException();
}
@Override
public void clearWarnings() throws SQLException {
throw new NotImplementedException();
}
@Override
public String getCursorName() throws SQLException {
throw new NotImplementedException();
}
@Override
public ResultSetMetaData getMetaData() throws SQLException {
return new ResultSetMetaData() {
@Override
public int getColumnCount() throws SQLException {
return columns.size();
}
@Override
public boolean isAutoIncrement(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isCaseSensitive(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isSearchable(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isCurrency(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public int isNullable(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isSigned(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getColumnDisplaySize(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public String getColumnLabel(int i) throws SQLException {
// HACK -- is this valid? ¯\_(ツ)_/¯
return getColumnName(i);
}
@Override
public String getColumnName(int i) throws SQLException {
return columns.get(i - 1);
}
@Override
public String getSchemaName(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getPrecision(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getScale(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public String getTableName(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public String getCatalogName(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getColumnType(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public String getColumnTypeName(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isReadOnly(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isWritable(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isDefinitelyWritable(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public String getColumnClassName(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public <T> T unwrap(Class<T> aClass) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isWrapperFor(Class<?> aClass) throws SQLException {
throw new NotImplementedException();
}
};
}
@Override
public Object getObject(int i) throws SQLException {
return readColumn(i);
}
@Override
public Object getObject(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public int findColumn(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public Reader getCharacterStream(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public Reader getCharacterStream(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public BigDecimal getBigDecimal(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public BigDecimal getBigDecimal(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isBeforeFirst() throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isAfterLast() throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isFirst() throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isLast() throws SQLException {
throw new NotImplementedException();
}
@Override
public void beforeFirst() throws SQLException {
throw new NotImplementedException();
}
@Override
public void afterLast() throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean first() throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean last() throws SQLException {
throw new NotImplementedException();
}
@Override
public int getRow() throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean absolute(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean relative(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean previous() throws SQLException {
throw new NotImplementedException();
}
@Override
public int getFetchDirection() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setFetchDirection(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getFetchSize() throws SQLException {
throw new NotImplementedException();
}
@Override
public void setFetchSize(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getType() throws SQLException {
throw new NotImplementedException();
}
@Override
public int getConcurrency() throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean rowUpdated() throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean rowInserted() throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean rowDeleted() throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateNull(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBoolean(int i, boolean b) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateByte(int i, byte b) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateShort(int i, short i1) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateInt(int i, int i1) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateLong(int i, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateFloat(int i, float v) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateDouble(int i, double v) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBigDecimal(int i, BigDecimal bigDecimal) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateString(int i, String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBytes(int i, byte[] bytes) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateDate(int i, Date date) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateTime(int i, Time time) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateTimestamp(int i, Timestamp timestamp) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateAsciiStream(int i, InputStream inputStream, int i1) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBinaryStream(int i, InputStream inputStream, int i1) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateCharacterStream(int i, Reader reader, int i1) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateObject(int i, Object o, int i1) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateObject(int i, Object o) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateNull(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBoolean(String s, boolean b) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateByte(String s, byte b) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateShort(String s, short i) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateInt(String s, int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateLong(String s, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateFloat(String s, float v) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateDouble(String s, double v) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBigDecimal(String s, BigDecimal bigDecimal) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateString(String s, String s1) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBytes(String s, byte[] bytes) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateDate(String s, Date date) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateTime(String s, Time time) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateTimestamp(String s, Timestamp timestamp) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateAsciiStream(String s, InputStream inputStream, int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBinaryStream(String s, InputStream inputStream, int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateCharacterStream(String s, Reader reader, int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateObject(String s, Object o, int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateObject(String s, Object o) throws SQLException {
throw new NotImplementedException();
}
@Override
public void insertRow() throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateRow() throws SQLException {
throw new NotImplementedException();
}
@Override
public void deleteRow() throws SQLException {
throw new NotImplementedException();
}
@Override
public void refreshRow() throws SQLException {
throw new NotImplementedException();
}
@Override
public void cancelRowUpdates() throws SQLException {
throw new NotImplementedException();
}
@Override
public void moveToInsertRow() throws SQLException {
throw new NotImplementedException();
}
@Override
public void moveToCurrentRow() throws SQLException {
throw new NotImplementedException();
}
@Override
public Statement getStatement() throws SQLException {
throw new NotImplementedException();
}
@Override
public Object getObject(int i, Map<String, Class<?>> map) throws SQLException {
throw new NotImplementedException();
}
@Override
public Ref getRef(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public Blob getBlob(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public Clob getClob(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public Array getArray(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public Object getObject(String s, Map<String, Class<?>> map) throws SQLException {
throw new NotImplementedException();
}
@Override
public Ref getRef(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public Blob getBlob(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public Clob getClob(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public Array getArray(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public Date getDate(int i, Calendar calendar) throws SQLException {
throw new NotImplementedException();
}
@Override
public Date getDate(String s, Calendar calendar) throws SQLException {
throw new NotImplementedException();
}
@Override
public Time getTime(int i, Calendar calendar) throws SQLException {
throw new NotImplementedException();
}
@Override
public Time getTime(String s, Calendar calendar) throws SQLException {
throw new NotImplementedException();
}
@Override
public Timestamp getTimestamp(int i, Calendar calendar) throws SQLException {
throw new NotImplementedException();
}
@Override
public Timestamp getTimestamp(String s, Calendar calendar) throws SQLException {
throw new NotImplementedException();
}
@Override
public URL getURL(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public URL getURL(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateRef(int i, Ref ref) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateRef(String s, Ref ref) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBlob(int i, Blob blob) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBlob(String s, Blob blob) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateClob(int i, Clob clob) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateClob(String s, Clob clob) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateArray(int i, Array array) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateArray(String s, Array array) throws SQLException {
throw new NotImplementedException();
}
@Override
public RowId getRowId(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public RowId getRowId(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateRowId(int i, RowId rowId) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateRowId(String s, RowId rowId) throws SQLException {
throw new NotImplementedException();
}
@Override
public int getHoldability() throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isClosed() throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateNString(int i, String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateNString(String s, String s1) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateNClob(int i, NClob nClob) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateNClob(String s, NClob nClob) throws SQLException {
throw new NotImplementedException();
}
@Override
public NClob getNClob(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public NClob getNClob(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public SQLXML getSQLXML(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public SQLXML getSQLXML(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateSQLXML(int i, SQLXML sqlxml) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateSQLXML(String s, SQLXML sqlxml) throws SQLException {
throw new NotImplementedException();
}
@Override
public String getNString(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public String getNString(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public Reader getNCharacterStream(int i) throws SQLException {
throw new NotImplementedException();
}
@Override
public Reader getNCharacterStream(String s) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateNCharacterStream(int i, Reader reader, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateNCharacterStream(String s, Reader reader, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateAsciiStream(int i, InputStream inputStream, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBinaryStream(int i, InputStream inputStream, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateCharacterStream(int i, Reader reader, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateAsciiStream(String s, InputStream inputStream, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBinaryStream(String s, InputStream inputStream, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateCharacterStream(String s, Reader reader, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBlob(int i, InputStream inputStream, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBlob(String s, InputStream inputStream, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateClob(int i, Reader reader, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateClob(String s, Reader reader, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateNClob(int i, Reader reader, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateNClob(String s, Reader reader, long l) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateNCharacterStream(int i, Reader reader) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateNCharacterStream(String s, Reader reader) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateAsciiStream(int i, InputStream inputStream) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBinaryStream(int i, InputStream inputStream) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateCharacterStream(int i, Reader reader) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateAsciiStream(String s, InputStream inputStream) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBinaryStream(String s, InputStream inputStream) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateCharacterStream(String s, Reader reader) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBlob(int i, InputStream inputStream) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateBlob(String s, InputStream inputStream) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateClob(int i, Reader reader) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateClob(String s, Reader reader) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateNClob(int i, Reader reader) throws SQLException {
throw new NotImplementedException();
}
@Override
public void updateNClob(String s, Reader reader) throws SQLException {
throw new NotImplementedException();
}
@Override
public <T> T getObject(int i, Class<T> aClass) throws SQLException {
throw new NotImplementedException();
}
@Override
public <T> T getObject(String s, Class<T> aClass) throws SQLException {
throw new NotImplementedException();
}
@Override
public <T> T unwrap(Class<T> aClass) throws SQLException {
throw new NotImplementedException();
}
@Override
public boolean isWrapperFor(Class<?> aClass) throws SQLException {
throw new NotImplementedException();
}
}
private static class NotImplementedException extends RuntimeException {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment