Skip to content

Commit

Permalink
test(dsl): for LowerDsl
Browse files Browse the repository at this point in the history
  • Loading branch information
waahhh committed Oct 23, 2023
1 parent 8e185c1 commit 05a1f75
Showing 1 changed file with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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<String> = 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<String> = expression // for type check

// then
val expected = Expressions.lower(
stringExpression1,
)

assertThat(actual).isEqualTo(expected)
}
}

0 comments on commit 05a1f75

Please sign in to comment.