}
@Test
public void test_Validate_Collect_Ok() {
final PuppetManifest pp = pf.createPuppetManifest();
final CollectExpression ce = pf.createCollectExpression();
pp.getStatements().add(ce);
ce.setClassReference(createNameOrReference("User"));
EqualityExpression predicate = pf.createEqualityExpression();
predicate.setLeftExpr(createNameOrReference("name"));
predicate.setOpName("==");
predicate.setRightExpr(createNameOrReference("Luke"));
VirtualCollectQuery q = pf.createVirtualCollectQuery();
q.setExpr(predicate);
ce.setQuery(q);
// -- test without attributes
tester.validator().checkCollectExpression(ce);
tester.diagnose().assertOK();
// -- add some attributes
AttributeOperations aos = pf.createAttributeOperations();
aos.getAttributes().add(createAttributeDefinition("x", "b"));
aos.getAttributes().add(createAttributeAddition("y", "b"));
ce.setAttributes(aos);
tester.validator().checkCollectExpression(ce);
tester.diagnose().assertOK();
// --test different class references
ce.setClassReference(createNameOrReference("::User"));
tester.validator().checkCollectExpression(ce);
tester.diagnose().assertOK();
ce.setClassReference(createNameOrReference("A::User::B"));
tester.validator().checkCollectExpression(ce);
tester.diagnose().assertOK();
// -- test exported query
ExportedCollectQuery eq = pf.createExportedCollectQuery();
eq.setExpr(predicate);
ce.setQuery(eq);
tester.validator().checkCollectExpression(ce);
tester.diagnose().assertOK();
// -- test non equality
predicate.setOpName("!=");