Skip to content

Commit

Permalink
Add unit test for H2 (both v1 and v2)
Browse files Browse the repository at this point in the history
  • Loading branch information
bog-walk committed Jan 17, 2024
1 parent 45c3136 commit f39b31f
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,29 @@ class H2Tests : DatabaseTestsBase() {
}
}

@Test
fun testH2V1WithBigDecimalFunctionThatReturnsShort() {
val testTable = object : Table("test_table") {
val number = short("number")
}

withDb(TestDB.allH2TestDB) {
try {
SchemaUtils.create(testTable)

testTable.batchInsert(listOf<Short>(2, 4, 6, 8, 10)) { n ->
this[testTable.number] = n
}

val average = testTable.number.avg()
val result = testTable.select(average).single()[average]
assertEquals("6.00".toBigDecimal(), result)
} finally {
SchemaUtils.drop(testTable)
}
}
}

class WrappedTransactionManager(val transactionManager: TransactionManager) :
TransactionManager by transactionManager

Expand Down

0 comments on commit f39b31f

Please sign in to comment.