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