public void testSqlEqualExpr() { SqlEqualExpr ex = new SqlEqualExpr(); ex.setSqlValue("ab"); assertEquals("C = 'ab'", sg.generate(ex)); ex.setSqlValue(null); assertEquals("C IS NULL", sg.generate(ex)); }
public void testAndOrExpr() { SqlEqualExpr ex = new SqlEqualExpr(); ex.setSqlValue(new Integer(1)); SqlAndExpr and = new SqlAndExpr(); and.getOperands().add(ex); SqlOrExpr or = new SqlOrExpr(); or.getOperands().add(ex); or.getOperands().add(ex); and.getOperands().add(or); assertEquals("(C = 1 AND (C = 1 OR C = 1))", sg.generate(and)); }
private void eqlExprWithOperandsTest(SqlExprWithOperands expr, String expected) { SqlEqualExpr opd1 = new SqlEqualExpr(); opd1.setColumnId("C1"); opd1.setSqlValue("c1"); expr.addOperand(opd1); SqlEqualExpr opd2 = new SqlEqualExpr(); opd2.setColumnId("C2"); opd2.setSqlValue("c2"); expr.addOperand(opd2); SqlGenerator sg = new SqlGenerator(); assertEquals(expected, sg.generate(expr)); }