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