### Question:
DatabaseConnection { public PreparedStatement prepareStatement(final String sql, final List<SQLParam> params) throws SQLException { LOG.ok("prepareStatement: statement {0}", sql); final List<SQLParam> out = new ArrayList<SQLParam>(); final String nomalized = SQLUtil.normalizeNullValues(sql, params, out); final PreparedStatement prepareStatement = getConnection().prepareStatement(nomalized); SQLUtil.setParams(prepareStatement, out); LOG.ok("prepareStatement: normalizzed statement {0} prepared", nomalized); return prepareStatement; } 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();  }### Answer:
@Test public void testPrepareStatementNullValues() throws Exception { final ExpectProxy<Connection> tpc = new ExpectProxy<Connection>(); final ExpectProxy<PreparedStatement> tps = new ExpectProxy<PreparedStatement>(); final PreparedStatement xps = tps.getProxy(PreparedStatement.class); tpc.expectAndReturn("prepareStatement", xps); DatabaseConnection dbc = new DatabaseConnection(tpc.getProxy(Connection.class)); dbc.prepareStatement(TEST_SQL_STATEMENT, null); assertTrue("statement created", tpc.isDone()); assertTrue("value binded", tps.isDone()); }
@Test public void testPrepareStatementEmptyValues() throws Exception { final ExpectProxy<Connection> tpc = new ExpectProxy<Connection>(); final ExpectProxy<PreparedStatement> tps = new ExpectProxy<PreparedStatement>(); final PreparedStatement xps = tps.getProxy(PreparedStatement.class); tpc.expectAndReturn("prepareStatement", xps); DatabaseConnection dbc = new DatabaseConnection(tpc.getProxy(Connection.class)); dbc.prepareStatement(TEST_SQL_STATEMENT, new ArrayList<SQLParam>()); assertTrue("statement created", tpc.isDone()); assertTrue("value binded", tps.isDone()); }
@Test public void testPrepareStatement() throws Exception { final ExpectProxy<Connection> tpc = new ExpectProxy<Connection>(); final ExpectProxy<PreparedStatement> tps = new ExpectProxy<PreparedStatement>(); final PreparedStatement xps = tps.getProxy(PreparedStatement.class); tpc.expectAndReturn("prepareStatement", xps); 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()); }