use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class SolutionModifierTest method testAddHavingExpr.
@ContractTest
public void testAddHavingExpr() throws ParseException {
SolutionModifierClause<?> solutionModifier = getProducer().newInstance();
AbstractQueryBuilder<?> builder = solutionModifier.addHaving(new E_Random());
assertContainsRegex(HAVING + "rand" + OPEN_PAREN + CLOSE_PAREN, builder.buildString());
solutionModifier.addHaving("?having2");
assertContainsRegex(HAVING + "rand" + OPEN_PAREN + CLOSE_PAREN + SPACE + var("having2"), builder.buildString());
}
use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class SolutionModifierTest method testAddGroupByVarAndExpr.
@ContractTest
public void testAddGroupByVarAndExpr() {
SolutionModifierClause<?> solutionModifier = getProducer().newInstance();
AbstractQueryBuilder<?> builder = solutionModifier.addGroupBy(Var.alloc("foo"), new E_Random());
assertContainsRegex(GROUP_BY + OPEN_PAREN + "rand" + OPEN_PAREN + CLOSE_PAREN + SPACE + "AS" + SPACE + var("foo") + CLOSE_PAREN, builder.buildString());
builder = solutionModifier.addGroupBy("bar");
assertContainsRegex(GROUP_BY + OPEN_PAREN + "rand" + OPEN_PAREN + CLOSE_PAREN + SPACE + "AS" + SPACE + var("foo") + CLOSE_PAREN + SPACE + var("bar"), builder.buildString());
}
use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class SolutionModifierTest method testAddOrderByExprAscending.
@ContractTest
public void testAddOrderByExprAscending() {
SolutionModifierClause<?> solutionModifier = getProducer().newInstance();
Expr e = new E_Random();
AbstractQueryBuilder<?> builder = solutionModifier.addOrderBy(e, Order.ASCENDING);
assertContainsRegex(ORDER_BY + "ASC" + OPEN_PAREN + "rand" + OPEN_PAREN + CLOSE_PAREN + CLOSE_PAREN, builder.buildString());
builder = solutionModifier.addOrderBy("bar");
assertContainsRegex(ORDER_BY + "ASC" + OPEN_PAREN + "rand" + OPEN_PAREN + CLOSE_PAREN + CLOSE_PAREN + SPACE + var("bar"), builder.buildString());
}
use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class SolutionModifierTest method testAddOrderByExpr.
@ContractTest
public void testAddOrderByExpr() {
SolutionModifierClause<?> solutionModifier = getProducer().newInstance();
Expr e = new E_Random();
AbstractQueryBuilder<?> builder = solutionModifier.addOrderBy(e);
assertContainsRegex(ORDER_BY + "rand" + OPEN_PAREN + CLOSE_PAREN, builder.buildString());
builder = solutionModifier.addOrderBy("bar");
assertContainsRegex(ORDER_BY + "rand" + OPEN_PAREN + CLOSE_PAREN + SPACE + var("bar"), builder.buildString());
}
use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class SolutionModifierTest method testSetVarsHaving.
@ContractTest
public void testSetVarsHaving() throws ParseException {
Var v = Var.alloc("v");
SolutionModifierClause<?> solutionModifier = getProducer().newInstance();
AbstractQueryBuilder<?> builder = solutionModifier.addHaving("?v");
String[] s = byLine(builder);
assertContainsRegex(HAVING + var("v"), s);
builder.setVar(v, Var.alloc("v2"));
s = byLine(builder);
assertContainsRegex(HAVING + var("v2"), s);
}
Aggregations