Skip to content

Commit 21ff9ed

Browse files
committed
test that column name in camel case works
1 parent d7c81ba commit 21ff9ed

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

mug-guava/src/test/java/com/google/mu/safesql/SafeSqlDbTest.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,29 @@ protected DatabaseOperation getTearDownOperation() {
598598
.containsExactly(bean);
599599
}
600600

601+
@Test public void query_withResultBeanType_columnLabelInCamelCase() throws Exception {
602+
ZonedDateTime barTime = ZonedDateTime.of(2024, 11, 1, 10, 20, 30, 0, ZoneId.of("UTC"));
603+
assertThat(
604+
SafeSql.of("insert into ITEMS(id, title, time, item_uuid) VALUES({id}, {title}, {time}, {uuid})",
605+
testId(), "bar", barTime, "uuid")
606+
.update(connection()))
607+
.isEqualTo(1);
608+
ItemBean bean = new ItemBean();
609+
bean.setId(testId());
610+
bean.setItemUuid("uuid");
611+
bean.setTime(barTime.toInstant());
612+
bean.setTitle("bar");
613+
assertThat(
614+
SafeSql.of("select id, time, title, item_uuid AS itemUuid from ITEMS where id = {id}", testId())
615+
.query(connection(), ItemBean.class))
616+
.containsExactly(bean);
617+
assertThat(
618+
SafeSql.of("select id, time, title, item_uuid AS ItemUuid from ITEMS where id = {id}", testId())
619+
.queryLazily(connection(), 2, ItemBean.class)
620+
.collect(toList()))
621+
.containsExactly(bean);
622+
}
623+
601624
@Test public void query_withResultBeanType_columnsFewerThanProperties() throws Exception {
602625
ZonedDateTime barTime = ZonedDateTime.of(2024, 11, 1, 10, 20, 30, 0, ZoneId.of("UTC"));
603626
assertThat(

0 commit comments

Comments
 (0)