Skip to content

Commit 966c4d7

Browse files
committed
Coverage
1 parent efb7f98 commit 966c4d7

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/test/kotlin/examples/kotlin/spring/canonical/CanonicalSpringKotlinTemplateDirectTest.kt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,18 @@ class CanonicalSpringKotlinTemplateDirectTest {
210210
}
211211
}
212212

213+
@Test
214+
fun testSelectOneWithAlias() {
215+
val name = template.selectOne(firstName)
216+
.from(Person, "p") {
217+
where(id, isEqualTo(1))
218+
}.withRowMapper { rs, _ ->
219+
rs.getString(1)
220+
}
221+
222+
assertThat(name).isEqualTo("Fred")
223+
}
224+
213225
@Test
214226
fun testSelectDistinct() {
215227
val rows = template.selectDistinct(lastName)
@@ -222,6 +234,18 @@ class CanonicalSpringKotlinTemplateDirectTest {
222234
assertThat(rows.size).isEqualTo(2)
223235
}
224236

237+
@Test
238+
fun testSelectDistinctWithAlias() {
239+
val rows = template.selectDistinct(lastName)
240+
.from(Person, "p") {
241+
orderBy(lastName)
242+
}.withRowMapper { rs, _ ->
243+
rs.getString(1)
244+
}
245+
246+
assertThat(rows.size).isEqualTo(2)
247+
}
248+
225249
@Test
226250
fun testSelectWithJoin() {
227251
val rows = template.select(id.`as`("A_ID"), firstName, lastName, birthDate, employed, occupation,

0 commit comments

Comments
 (0)