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