@Test public void testPrepareCall() throws Exception { final ExpectProxy<Connection> tpc = new ExpectProxy<Connection>(); final ExpectProxy<CallableStatement> tps = new ExpectProxy<CallableStatement>(); final CallableStatement cs = tps.getProxy(CallableStatement.class); tpc.expectAndReturn("prepareStatement", cs); tps.expectAndReturn("setObject", LOGIN); tps.expectAndReturn("setObject", NAME); tps.expectAndReturn("execute", true); DatabaseConnection dbc = new DatabaseConnection(tpc.getProxy(Connection.class)); final PreparedStatement ps = dbc.prepareStatement(SELECT_SQL_STATEMENT, values); ps.execute(); assertTrue("statement created", tpc.isDone()); assertTrue("value binded", tps.isDone()); }
public CallableStatement prepareCall(final String sql, final List<SQLParam> params) throws SQLException { LOG.ok("normalize call statement {0}", sql); final List<SQLParam> out = new ArrayList<SQLParam>(); final String nomalized = SQLUtil.normalizeNullValues(sql, params, out); final CallableStatement prepareCall = getConnection().prepareCall(nomalized); SQLUtil.setParams(prepareCall, out); LOG.ok("call statement {0} normalizead and prepared", nomalized); return prepareCall; }
DatabaseConnection { public CallableStatement prepareCall(final String sql, final List<SQLParam> params) throws SQLException { LOG.ok("normalize call statement {0}", sql); final List<SQLParam> out = new ArrayList<SQLParam>(); final String nomalized = SQLUtil.normalizeNullValues(sql, params, out); final CallableStatement prepareCall = getConnection().prepareCall(nomalized); SQLUtil.setParams(prepareCall, out); LOG.ok("call statement {0} normalizead and prepared", nomalized); return prepareCall; } }
DatabaseConnection { public CallableStatement prepareCall(final String sql, final List<SQLParam> params) throws SQLException { LOG.ok("normalize call statement {0}", sql); final List<SQLParam> out = new ArrayList<SQLParam>(); final String nomalized = SQLUtil.normalizeNullValues(sql, params, out); final CallableStatement prepareCall = getConnection().prepareCall(nomalized); SQLUtil.setParams(prepareCall, out); LOG.ok("call statement {0} normalizead and prepared", nomalized); return prepareCall; } DatabaseConnection();  DatabaseConnection(final Connection conn); }
DatabaseConnection { public CallableStatement prepareCall(final String sql, final List<SQLParam> params) throws SQLException { LOG.ok("normalize call statement {0}", sql); final List<SQLParam> out = new ArrayList<SQLParam>(); final String nomalized = SQLUtil.normalizeNullValues(sql, params, out); final CallableStatement prepareCall = getConnection().prepareCall(nomalized); SQLUtil.setParams(prepareCall, out); LOG.ok("call statement {0} normalizead and prepared", nomalized); return prepareCall; } DatabaseConnection();  DatabaseConnection(final Connection conn); @SuppressWarnings("deprecation") void dispose(); void test(); Connection getConnection(); void setConnection(final Connection connection); PreparedStatement prepareStatement(final String sql, final List<SQLParam> params); PreparedStatement prepareStatement(DatabaseQueryBuilder query); CallableStatement prepareCall(final String sql, final List<SQLParam> params); void commit(); }
DatabaseConnection { public CallableStatement prepareCall(final String sql, final List<SQLParam> params) throws SQLException { LOG.ok("normalize call statement {0}", sql); final List<SQLParam> out = new ArrayList<SQLParam>(); final String nomalized = SQLUtil.normalizeNullValues(sql, params, out); final CallableStatement prepareCall = getConnection().prepareCall(nomalized); SQLUtil.setParams(prepareCall, out); LOG.ok("call statement {0} normalizead and prepared", nomalized); return prepareCall; } DatabaseConnection();  DatabaseConnection(final Connection conn); @SuppressWarnings("deprecation") void dispose(); void test(); Connection getConnection(); void setConnection(final Connection connection); PreparedStatement prepareStatement(final String sql, final List<SQLParam> params); PreparedStatement prepareStatement(DatabaseQueryBuilder query); CallableStatement prepareCall(final String sql, final List<SQLParam> params); void commit();  }