diff --git a/dsl/jpql/src/test/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/expression/LowerDslTest.kt b/dsl/jpql/src/test/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/expression/LowerDslTest.kt new file mode 100644 index 000000000..bc45c2eac --- /dev/null +++ b/dsl/jpql/src/test/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/expression/LowerDslTest.kt @@ -0,0 +1,47 @@ +package com.linecorp.kotlinjdsl.dsl.jpql.expression + +import com.linecorp.kotlinjdsl.dsl.jpql.queryPart +import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expression +import com.linecorp.kotlinjdsl.querymodel.jpql.expression.Expressions +import org.assertj.core.api.WithAssertions +import org.junit.jupiter.api.Test + +class LowerDslTest : WithAssertions { + private val string1 = "string1" + + private val stringExpression1 = Expressions.value("string1") + + @Test + fun `lower() with a string`() { + // when + val expression = queryPart { + lower(string1) + }.toExpression() + + val actual: Expression = expression // for type check + + // then + val expected = Expressions.lower( + Expressions.value(string1), + ) + + assertThat(actual).isEqualTo(expected) + } + + @Test + fun `lower() with a string expression`() { + // when + val expression = queryPart { + lower(stringExpression1) + }.toExpression() + + val actual: Expression = expression // for type check + + // then + val expected = Expressions.lower( + stringExpression1, + ) + + assertThat(actual).isEqualTo(expected) + } +}