use of io.confluent.ksql.parser.tree.SearchedCaseExpression in project ksql by confluentinc.
the class ExpressionFormatterTest method shouldFormatSearchedCaseExpression.
@Test
public void shouldFormatSearchedCaseExpression() {
final SearchedCaseExpression expression = new SearchedCaseExpression(Collections.singletonList(new WhenClause(new StringLiteral("foo"), new LongLiteral("1"))), Optional.empty());
assertThat(ExpressionFormatter.formatExpression(expression), equalTo("(CASE WHEN 'foo' THEN 1 END)"));
}
use of io.confluent.ksql.parser.tree.SearchedCaseExpression in project ksql by confluentinc.
the class ExpressionFormatterTest method shouldFormatSearchedCaseExpressionWithDefaultValue.
@Test
public void shouldFormatSearchedCaseExpressionWithDefaultValue() {
final SearchedCaseExpression expression = new SearchedCaseExpression(Collections.singletonList(new WhenClause(new StringLiteral("foo"), new LongLiteral("1"))), Optional.of(new LongLiteral("2")));
assertThat(ExpressionFormatter.formatExpression(expression), equalTo("(CASE WHEN 'foo' THEN 1 ELSE 2 END)"));
}
Aggregations