use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class WhereClauseTest method testAddMinus.
@ContractTest
public void testAddMinus() {
SelectBuilder sb = new SelectBuilder();
sb.addPrefix("pfx", "uri").addVar("?x").addWhere("<one>", "<two>", "three");
WhereClause<?> whereClause = getProducer().newInstance();
AbstractQueryBuilder<?> builder = whereClause.addMinus(sb);
String str = builder.buildString();
assertContainsRegex(MINUS + OPEN_CURLY + uri("one") + SPACE + uri("two") + SPACE + quote("three") + CLOSE_CURLY, str);
}
use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class GraphMem_CS method testHasStatistics.
@ContractTest
public void testHasStatistics() {
GraphStatisticsHandler h = graphProducer.newInstance().getStatisticsHandler();
assertNotNull(h);
}
use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class GraphMem_CS method testUnnecessaryMatches.
@ContractTest
public void testUnnecessaryMatches() {
Node special = new Node_URI("eg:foo") {
@Override
public boolean matches(Node s) {
fail("Matched called superfluously.");
return true;
}
};
Graph g = graphWith(graphProducer.newInstance(), "x p y");
g.add(new Triple(special, special, special));
exhaust(g.find(special, Node.ANY, Node.ANY));
exhaust(g.find(Node.ANY, special, Node.ANY));
exhaust(g.find(Node.ANY, Node.ANY, special));
}
use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class SolutionModifierTest method testSetVarsGroupBy.
@ContractTest
public void testSetVarsGroupBy() {
Var v = Var.alloc("v");
SolutionModifierClause<?> solutionModifier = getProducer().newInstance();
AbstractQueryBuilder<?> builder = solutionModifier.addGroupBy("?v");
String[] s = byLine(builder);
assertContainsRegex(GROUP_BY + var("v"), s);
builder.setVar(v, Var.alloc("v2"));
s = byLine(builder);
assertContainsRegex(GROUP_BY + var("v2"), s);
}
use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class SolutionModifierTest method testAddOrderByExprDescending.
@ContractTest
public void testAddOrderByExprDescending() {
SolutionModifierClause<?> solutionModifier = getProducer().newInstance();
Expr e = new E_Random();
AbstractQueryBuilder<?> builder = solutionModifier.addOrderBy(e, Order.DESCENDING);
assertContainsRegex(ORDER_BY + "DESC" + OPEN_PAREN + "rand" + OPEN_PAREN + CLOSE_PAREN + CLOSE_PAREN, builder.buildString());
builder = solutionModifier.addOrderBy("bar");
assertContainsRegex(ORDER_BY + "DESC" + OPEN_PAREN + "rand" + OPEN_PAREN + CLOSE_PAREN + CLOSE_PAREN + SPACE + var("bar"), builder.buildString());
}
Aggregations