String s = serializeFormatted(pp);
assertEquals("serialization should produce specified result", Sample_Collect, s);
// -- test exported query
ExportedCollectQuery eq = pf.createExportedCollectQuery();
eq.setExpr(predicate);
ce.setQuery(eq);
s = serializeFormatted(pp);
assertEquals("serialization should produce specified result", Sample_Collect_Exported, s);
// -- test with more complex query
// -- test non equality
predicate.setOpName("!=");
// -- test and / or
AndExpression and = pf.createAndExpression();
and.setLeftExpr(predicate);
OrExpression or = pf.createOrExpression();
EqualityExpression predicate2 = pf.createEqualityExpression();
predicate2.setLeftExpr(createNameOrReference("name"));
predicate2.setOpName("!=");
predicate2.setRightExpr(createNameOrReference("Darth"));
EqualityExpression predicate3 = pf.createEqualityExpression();
predicate3.setLeftExpr(createNameOrReference("name"));
predicate3.setOpName("!=");
predicate3.setRightExpr(createNameOrReference("Vader"));
or.setLeftExpr(predicate2);
or.setRightExpr(predicate3);
ParenthesisedExpression pe = pf.createParenthesisedExpression();
pe.setExpr(or);
and.setRightExpr(pe);
eq.setExpr(and);
s = serializeFormatted(pp);
assertEquals("serialization should produce specified result", Sample_Collect_Complex, s);
}