|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2017 the original author or authors |
| 2 | + * Copyright 2002-2019 the original author or authors |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -51,6 +51,13 @@ class JdbcOperationsExtensionsTests {
|
51 | 51 | verify(template, times(1)).queryForObject(eq(sql), any<RowMapper<Int>>(), eq(3))
|
52 | 52 | }
|
53 | 53 |
|
| 54 | + @Test // gh-22682 |
| 55 | + fun `queryForObject with nullable RowMapper-like function`() { |
| 56 | + val sql = "select age from customer where id = ?" |
| 57 | + template.queryForObject(sql, 3) { _, _ -> null as Int? } |
| 58 | + verify(template, times(1)).queryForObject(eq(sql), any<RowMapper<Int?>>(), eq(3)) |
| 59 | + } |
| 60 | + |
54 | 61 | @Test
|
55 | 62 | fun `queryForObject with reified type parameters and argTypes`() {
|
56 | 63 | val sql = "select age from customer where id = ?"
|
@@ -102,6 +109,13 @@ class JdbcOperationsExtensionsTests {
|
102 | 109 | verify(template, times(1)).query(eq(sql), any<ResultSetExtractor<Int>>(), eq(3))
|
103 | 110 | }
|
104 | 111 |
|
| 112 | + @Test // gh-22682 |
| 113 | + fun `query with nullable ResultSetExtractor-like function`() { |
| 114 | + val sql = "select age from customer where id = ?" |
| 115 | + template.query<Int?>(sql, 3) { _ -> null } |
| 116 | + verify(template, times(1)).query(eq(sql), any<ResultSetExtractor<Int?>>(), eq(3)) |
| 117 | + } |
| 118 | + |
105 | 119 | @Test
|
106 | 120 | fun `query with RowCallbackHandler-like function`() {
|
107 | 121 | val sql = "select age from customer where id = ?"
|
|
0 commit comments