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