Search in sources :

Example 36 with ContractTest

use of org.xenei.junit.contract.ContractTest in project jena by apache.

the class GraphContractTest method testContains_Node_Node_Node_ByValue.

@ContractTest
public void testContains_Node_Node_Node_ByValue() {
    Node x = node("x");
    Node P = node("P");
    if (producer.newInstance().getCapabilities().handlesLiteralTyping()) {
        Graph g1 = graphWith(producer.newInstance(), "x P '1'xsd:integer");
        assertTrue(String.format("literal type equality failed, does %s really implement literal typing", g1.getClass()), g1.contains(x, P, node("'01'xsd:int")));
        //
        Graph g2 = graphWith(producer.newInstance(), "x P '1'xsd:int");
        assertTrue("Literal equality with '1'xsd:integer failed", g2.contains(x, P, node("'1'xsd:integer")));
        //
        Graph g3 = graphWith(producer.newInstance(), "x P '123'xsd:string");
        assertTrue("Literal equality with '123' failed", g3.contains(x, P, node("'123'")));
    }
}
Also used : GraphHelper.memGraph(org.apache.jena.testing_framework.GraphHelper.memGraph) ContractTest(org.xenei.junit.contract.ContractTest)

Example 37 with ContractTest

use of org.xenei.junit.contract.ContractTest in project jena by apache.

the class GraphMem_CS method testContainsConcreteDoesntUseFind.

@ContractTest
public void testContainsConcreteDoesntUseFind() {
    Graph g = new GraphMemWithoutFind();
    graphAdd(g, "x P y; a Q b");
    assertTrue(g.contains(triple("x P y")));
    assertTrue(g.contains(triple("a Q b")));
    assertFalse(g.contains(triple("a P y")));
    assertFalse(g.contains(triple("y R b")));
}
Also used : Graph(org.apache.jena.graph.Graph) ContractTest(org.xenei.junit.contract.ContractTest)

Example 38 with ContractTest

use of org.xenei.junit.contract.ContractTest in project jena by apache.

the class DatasetClauseTest method testGetDatasetHandler.

@ContractTest
public void testGetDatasetHandler() {
    DatasetClause<?> datasetClause = getProducer().newInstance();
    DatasetHandler dsHandler = datasetClause.getDatasetHandler();
    assertNotNull(dsHandler);
}
Also used : DatasetHandler(org.apache.jena.arq.querybuilder.handlers.DatasetHandler) ContractTest(org.xenei.junit.contract.ContractTest)

Example 39 with ContractTest

use of org.xenei.junit.contract.ContractTest in project jena by apache.

the class PrologClauseTest method testGetPrologHandler.

@ContractTest
public void testGetPrologHandler() {
    PrologClause<?> prologClause = getProducer().newInstance();
    PrologHandler handler = prologClause.getPrologHandler();
    assertNotNull(handler);
}
Also used : PrologHandler(org.apache.jena.arq.querybuilder.handlers.PrologHandler) ContractTest(org.xenei.junit.contract.ContractTest)

Example 40 with ContractTest

use of org.xenei.junit.contract.ContractTest in project jena by apache.

the class SelectClauseTest method testAddVarNode.

@ContractTest
public void testAddVarNode() throws Exception {
    Var v = Var.alloc("one");
    SelectClause<?> selectClause = getProducer().newInstance();
    selectClause.addVar("one");
    Query query = getQuery(selectClause.addVar(NodeFactory.createVariable("one")));
    VarExprList expr = query.getProject();
    assertEquals(1, expr.size());
    assertTrue(expr.contains(v));
}
Also used : Query(org.apache.jena.query.Query) Var(org.apache.jena.sparql.core.Var) VarExprList(org.apache.jena.sparql.core.VarExprList) ContractTest(org.xenei.junit.contract.ContractTest)

Aggregations

ContractTest (org.xenei.junit.contract.ContractTest)102 GraphHelper.memGraph (org.apache.jena.testing_framework.GraphHelper.memGraph)51 Graph (org.apache.jena.graph.Graph)16 Var (org.apache.jena.sparql.core.Var)13 Query (org.apache.jena.query.Query)9 E_Random (org.apache.jena.sparql.expr.E_Random)9 SelectBuilder (org.apache.jena.arq.querybuilder.SelectBuilder)6 DeleteDeniedException (org.apache.jena.shared.DeleteDeniedException)6 VarExprList (org.apache.jena.sparql.core.VarExprList)6 MalformedURLException (java.net.MalformedURLException)5 URISyntaxException (java.net.URISyntaxException)5 ClosedException (org.apache.jena.shared.ClosedException)5 Expr (org.apache.jena.sparql.expr.Expr)5 Triple (org.apache.jena.graph.Triple)4 PrefixMapping (org.apache.jena.shared.PrefixMapping)3 TriplePath (org.apache.jena.sparql.core.TriplePath)3 Node (org.apache.jena.graph.Node)2 TransactionHandler (org.apache.jena.graph.TransactionHandler)2 Intersection (org.apache.jena.graph.compose.Intersection)2 GraphWithPerform (org.apache.jena.graph.impl.GraphWithPerform)2