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