Skip to content

Commit 026ebbc

Browse files
committed
Invalid cast tests
1 parent 735b23b commit 026ebbc

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/test/kotlin/examples/kotlin/animal/data/KCaseExpressionTest.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,4 +947,21 @@ class KCaseExpressionTest {
947947
select(case (id) { `else`("Fred") }) { from (animalData) }
948948
}.withMessage(Messages.getString("ERROR.40"))
949949
}
950+
951+
@Test
952+
fun testInvalidCastMissingAs() {
953+
assertThatExceptionOfType(KInvalidSQLException::class.java).isThrownBy {
954+
cast {}
955+
}.withMessage(Messages.getString("ERROR.43"))
956+
}
957+
958+
@Test
959+
fun testInvalidCastDoubleAs() {
960+
assertThatExceptionOfType(KInvalidSQLException::class.java).isThrownBy {
961+
cast {
962+
"Fred" `as` "VARCHAR"
963+
"Wilma" `as` "VARCHAR"
964+
}
965+
}.withMessage(Messages.getString("ERROR.43"))
966+
}
950967
}

0 commit comments

Comments
 (0)