public void testSqlUpperExpression() {
log.debug("Testing SqlUpperExpression");
// constructing
try {
new SqlUpperExpression(null);
fail("Constructing of SqlUpperExpression with NULL as SqlExpression argument should fail");
} catch (Exception e) {
// normal
}
// SQL String
assertEquals("SqlUpperExpression must return \"UPPER()\"",
new SqlUpperExpression(new MockSqlStringExpression(""))
.toSqlString(), "UPPER()");
assertEquals("SqlUpperExpression must return \"UPPER(a)\"",
new SqlUpperExpression(new MockSqlStringExpression("a"))
.toSqlString(), "UPPER(a)");
// SQL arguments
assertTrue("SqlUpperExpression must return an empty array", Arrays
.equals(new SqlUpperExpression(new MockSqlStringExpression(""))
.getValues(), new Object[0]));
assertTrue("SqlUpperExpression must return an empty array", Arrays
.equals(new SqlUpperExpression(new MockSqlStringExpression(
new Object[0])).getValues(), new Object[0]));
assertTrue("SqlUpperExpression must return (\"a\") as values", Arrays
.equals(new SqlUpperExpression(new MockSqlStringExpression(
new Object[] { "a" })).getValues(),
new Object[] { "a" }));
}