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