public void testCombineConditionAndNoCondition() {
Attribute id = SQL.parseAttribute("TABLE.ID");
db.setNullable(id, false);
NodeMaker x = new TypedNodeMaker(TypedNodeMaker.PLAIN_LITERAL, new Column(id), true);
Map<Var,NodeMaker> map = Collections.singletonMap(Var.alloc("x"), x);
BindingMaker bm = new BindingMaker(map, null);
RelationBuilder b1 = new RelationBuilder(db);
RelationBuilder b2 = new RelationBuilder(db);
b1.addProjection(id);
b2.addProjection(id);
b1.addCondition("TABLE.VALUE=1");
CompatibleRelationGroup group = new CompatibleRelationGroup();
Relation r1 = b1.buildRelation();
Relation r2 = b2.buildRelation();
group.addBindingMaker(r1, bm);
assertTrue(group.isCompatible(r2));
group.addBindingMaker(r2, bm);
assertEquals(2, group.bindingMakers().size());
assertTrue(group.baseRelation().projections().contains(new ExpressionProjectionSpec(r1.condition())));
assertEquals(2, group.baseRelation().projections().size());
assertEquals(Expression.TRUE, group.baseRelation().condition());
Iterator<BindingMaker> it = group.bindingMakers().iterator();
BindingMaker bm3 = it.next();
BindingMaker bm4 = it.next();
assertTrue((bm3.condition() == null && bm4.condition() != null)
|| (bm3.condition() != null && bm4.condition() == null));
}