@@ -220,7 +220,7 @@ public void testQueryForInt() throws Exception {
220
220
String sql = "SELECT AGE FROM CUSTMR WHERE ID = 3" ;
221
221
given (this .resultSet .next ()).willReturn (true , false );
222
222
given (this .resultSet .getInt (1 )).willReturn (22 );
223
- int i = this .template .queryForInt (sql );
223
+ int i = this .template .queryForObject (sql , Integer . class ). intValue ( );
224
224
assertEquals ("Return of an int" , 22 , i );
225
225
verify (this .resultSet ).close ();
226
226
verify (this .statement ).close ();
@@ -231,7 +231,7 @@ public void testQueryForLong() throws Exception {
231
231
String sql = "SELECT AGE FROM CUSTMR WHERE ID = 3" ;
232
232
given (this .resultSet .next ()).willReturn (true , false );
233
233
given (this .resultSet .getLong (1 )).willReturn (87L );
234
- long l = this .template .queryForLong (sql );
234
+ long l = this .template .queryForObject (sql , Long . class ). longValue ( );
235
235
assertEquals ("Return of a long" , 87 , l );
236
236
verify (this .resultSet ).close ();
237
237
verify (this .statement ).close ();
@@ -342,7 +342,7 @@ public void testQueryForIntWithArgs() throws Exception {
342
342
String sql = "SELECT AGE FROM CUSTMR WHERE ID = ?" ;
343
343
given (this .resultSet .next ()).willReturn (true , false );
344
344
given (this .resultSet .getInt (1 )).willReturn (22 );
345
- int i = this .template .queryForInt (sql , new Object [] {3 });
345
+ int i = this .template .queryForObject (sql , new Object [] {3 }, Integer . class ). intValue ( );
346
346
assertEquals ("Return of an int" , 22 , i );
347
347
verify (this .preparedStatement ).setObject (1 , 3 );
348
348
verify (this .resultSet ).close ();
@@ -354,7 +354,7 @@ public void testQueryForLongWithArgs() throws Exception {
354
354
String sql = "SELECT AGE FROM CUSTMR WHERE ID = ?" ;
355
355
given (this .resultSet .next ()).willReturn (true , false );
356
356
given (this .resultSet .getLong (1 )).willReturn (87L );
357
- long l = this .template .queryForLong (sql , new Object [] {3 });
357
+ long l = this .template .queryForObject (sql , new Object [] {3 }, Long . class ). longValue ( );
358
358
assertEquals ("Return of a long" , 87 , l );
359
359
verify (this .preparedStatement ).setObject (1 , 3 );
360
360
verify (this .resultSet ).close ();
0 commit comments