public void testNOT() {
Table table = getBasicTable();
SelectStatement selectStatement = table.getSelectStatement();
SelectTableReference ref = selectStatement.getSelectTableReference();
CombinedConstraint and = selectStatement.getWhere();
BooleanConstraint bc = and.createLIKE();
bc.addPart(ref.newColumnReference("MyName"));
bc.addPart("%a%");
CombinedConstraint or = and.createOrConstraint();
or.setNOT(true);
bc = or.createEQ();
bc.addPart(ref.newColumnReference("MyIndex"));
bc.addPart(1);
SQLGenerator gen = getSQLGenerator();
String query = gen.getQuery(selectStatement);
assertEquals("SELECT MyIndex, MyName, MyDate FROM MySchema.MyTable WHERE (MyName LIKE '%a%' AND NOT (MyIndex=1))", query);
bc = or.createEQ();
bc.addPart(ref.newColumnReference("MyIndex"));
bc.addPart(2);
query = gen.getQuery(selectStatement);
assertEquals("SELECT MyIndex, MyName, MyDate FROM MySchema.MyTable WHERE (MyName LIKE '%a%' AND (NOT (MyIndex=1 OR MyIndex=2)))", query);
}