Skip to content

Clean Up Deprecated Method Call #624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void testCacheInitialization() throws Exception {

private void assertCorrectSetup(DataSource dataSource) {
JdbcTemplate t = new JdbcTemplate(dataSource);
assertEquals(1, t.queryForInt("select count(*) from T_TEST"));
assertEquals(1, t.queryForObject("select count(*) from T_TEST", Integer.class).intValue());
}

public static class CacheData implements InitializingBean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public void testQueryForInt() throws Exception {
String sql = "SELECT AGE FROM CUSTMR WHERE ID = 3";
given(this.resultSet.next()).willReturn(true, false);
given(this.resultSet.getInt(1)).willReturn(22);
int i = this.template.queryForInt(sql);
int i = this.template.queryForObject(sql,Integer.class).intValue();
assertEquals("Return of an int", 22, i);
verify(this.resultSet).close();
verify(this.statement).close();
Expand All @@ -231,7 +231,7 @@ public void testQueryForLong() throws Exception {
String sql = "SELECT AGE FROM CUSTMR WHERE ID = 3";
given(this.resultSet.next()).willReturn(true, false);
given(this.resultSet.getLong(1)).willReturn(87L);
long l = this.template.queryForLong(sql);
long l = this.template.queryForObject(sql, Long.class).longValue();
assertEquals("Return of a long", 87, l);
verify(this.resultSet).close();
verify(this.statement).close();
Expand Down Expand Up @@ -342,7 +342,7 @@ public void testQueryForIntWithArgs() throws Exception {
String sql = "SELECT AGE FROM CUSTMR WHERE ID = ?";
given(this.resultSet.next()).willReturn(true, false);
given(this.resultSet.getInt(1)).willReturn(22);
int i = this.template.queryForInt(sql, new Object[] {3});
int i = this.template.queryForObject(sql, new Object[] {3}, Integer.class).intValue();
assertEquals("Return of an int", 22, i);
verify(this.preparedStatement).setObject(1, 3);
verify(this.resultSet).close();
Expand All @@ -354,7 +354,7 @@ public void testQueryForLongWithArgs() throws Exception {
String sql = "SELECT AGE FROM CUSTMR WHERE ID = ?";
given(this.resultSet.next()).willReturn(true, false);
given(this.resultSet.getLong(1)).willReturn(87L);
long l = this.template.queryForLong(sql, new Object[] {3});
long l = this.template.queryForObject(sql, new Object[] {3}, Long.class).longValue();
assertEquals("Return of a long", 87, l);
verify(this.preparedStatement).setObject(1, 3);
verify(this.resultSet).close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public void testQueryForIntWithParamMap() throws Exception {

MapSqlParameterSource parms = new MapSqlParameterSource();
parms.addValue("id", 3);
int i = template.queryForInt("SELECT AGE FROM CUSTMR WHERE ID = :id", parms);
int i = template.queryForObject("SELECT AGE FROM CUSTMR WHERE ID = :id", parms, Integer.class).intValue();

assertEquals("Return of an int", 22, i);
verify(connection).prepareStatement("SELECT AGE FROM CUSTMR WHERE ID = ?");
Expand All @@ -278,7 +278,7 @@ public void testQueryForLongWithParamBean() throws Exception {
BeanPropertySqlParameterSource parms = new BeanPropertySqlParameterSource(
new ParameterBean(3));

long l = template.queryForLong("SELECT AGE FROM CUSTMR WHERE ID = :id", parms);
long l = template.queryForObject("SELECT AGE FROM CUSTMR WHERE ID = :id", parms, Long.class).longValue();

assertEquals("Return of a long", 87, l);
verify(connection).prepareStatement("SELECT AGE FROM CUSTMR WHERE ID = ?");
Expand Down