use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class WhereClauseTest method testSetVarsInOptional.
@ContractTest
public void testSetVarsInOptional() {
Var v = Var.alloc("v");
WhereClause<?> whereClause = getProducer().newInstance();
AbstractQueryBuilder<?> builder = whereClause.addOptional(new Triple(NodeFactory.createURI("one"), NodeFactory.createURI("two"), v));
assertContainsRegex(WHERE + OPEN_CURLY + "OPTIONAL" + SPACE + OPEN_CURLY + uri("one") + SPACE + uri("two") + SPACE + var("v") + OPT_SPACE + CLOSE_CURLY + CLOSE_CURLY, builder.buildString());
builder.setVar(v, NodeFactory.createURI("three"));
assertContainsRegex(WHERE + OPEN_CURLY + "OPTIONAL" + SPACE + OPEN_CURLY + uri("one") + SPACE + uri("two") + SPACE + uri("three") + OPT_SPACE + CLOSE_CURLY + CLOSE_CURLY, builder.buildString());
}
use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class SelectClauseTest method getSelectHandlerTest.
@ContractTest
public void getSelectHandlerTest() {
SelectClause<?> selectClause = getProducer().newInstance();
SelectHandler handler = selectClause.getSelectHandler();
assertNotNull(handler);
}
use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class SelectClauseTest method testAddVarVar.
@ContractTest
public void testAddVarVar() throws Exception {
Var v = Var.alloc("one");
SelectClause<?> selectClause = getProducer().newInstance();
Query query = getQuery(selectClause.addVar(v));
VarExprList expr = query.getProject();
assertEquals(1, expr.size());
assertTrue(expr.contains(v));
}
use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class SolutionModifierTest method testAddGroupByExpr.
@ContractTest
public void testAddGroupByExpr() {
SolutionModifierClause<?> solutionModifier = getProducer().newInstance();
AbstractQueryBuilder<?> builder = solutionModifier.addGroupBy(new E_Random());
assertContainsRegex(GROUP_BY + "rand" + OPEN_PAREN + CLOSE_PAREN, builder.buildString());
builder = solutionModifier.addGroupBy("bar");
assertContainsRegex(GROUP_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 GraphContractTest method testDelete_Triple_FromNothing.
@ContractTest
public void testDelete_Triple_FromNothing() {
Graph g = producer.newInstance();
g.getEventManager().register(GL);
txnBegin(g);
g.delete(triple("quint rdf:subject S"));
txnCommit(g);
GL.assertContains("delete", g, triple("quint rdf:subject S"));
}
Aggregations