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