|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2017 the original author or authors |
|
|
|
* Copyright 2002-2019 the original author or authors |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -51,6 +51,13 @@ class JdbcOperationsExtensionsTests { |
|
|
|
verify(template, times(1)).queryForObject(eq(sql), any<RowMapper<Int>>(), eq(3)) |
|
|
|
verify(template, times(1)).queryForObject(eq(sql), any<RowMapper<Int>>(), eq(3)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test // gh-22682 |
|
|
|
|
|
|
|
fun `queryForObject with nullable RowMapper-like function`() { |
|
|
|
|
|
|
|
val sql = "select age from customer where id = ?" |
|
|
|
|
|
|
|
template.queryForObject(sql, 3) { _, _ -> null as Int? } |
|
|
|
|
|
|
|
verify(template, times(1)).queryForObject(eq(sql), any<RowMapper<Int?>>(), eq(3)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun `queryForObject with reified type parameters and argTypes`() { |
|
|
|
fun `queryForObject with reified type parameters and argTypes`() { |
|
|
|
val sql = "select age from customer where id = ?" |
|
|
|
val sql = "select age from customer where id = ?" |
|
|
|
@ -102,6 +109,13 @@ class JdbcOperationsExtensionsTests { |
|
|
|
verify(template, times(1)).query(eq(sql), any<ResultSetExtractor<Int>>(), eq(3)) |
|
|
|
verify(template, times(1)).query(eq(sql), any<ResultSetExtractor<Int>>(), eq(3)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test // gh-22682 |
|
|
|
|
|
|
|
fun `query with nullable ResultSetExtractor-like function`() { |
|
|
|
|
|
|
|
val sql = "select age from customer where id = ?" |
|
|
|
|
|
|
|
template.query<Int?>(sql, 3) { _ -> null } |
|
|
|
|
|
|
|
verify(template, times(1)).query(eq(sql), any<ResultSetExtractor<Int?>>(), eq(3)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun `query with RowCallbackHandler-like function`() { |
|
|
|
fun `query with RowCallbackHandler-like function`() { |
|
|
|
val sql = "select age from customer where id = ?" |
|
|
|
val sql = "select age from customer where id = ?" |
|
|
|
|