Search in sources :

Example 31 with ContractTest

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

the class GraphEventManagerContractTest method testDeleteGraph.

/**
	 * Test that deleting a graph is reported as deleting a graph.
	 */
@ContractTest
public void testDeleteGraph() {
    gem.register(L);
    Graph other = Mockito.mock(Graph.class);
    gem.notifyDeleteGraph(mockGraph, other);
    L.assertHas(new Object[] { "deleteGraph", mockGraph, other });
}
Also used : Graph(org.apache.jena.graph.Graph) ContractTest(org.xenei.junit.contract.ContractTest)

Example 32 with ContractTest

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

the class GraphContractTest method testFind_Triple_MatchLanguagedLiteralCaseInsensitive.

@ContractTest
public void testFind_Triple_MatchLanguagedLiteralCaseInsensitive() {
    Graph m = graphWith(producer.newInstance(), "a p 'chat'en");
    Node chaten = node("'chat'en"), chatEN = node("'chat'EN");
    assertDiffer(chaten, chatEN);
    assertTrue(chaten.sameValueAs(chatEN));
    assertEquals(chaten.getIndexingValue(), chatEN.getIndexingValue());
    assertEquals(1, m.find(new Triple(Node.ANY, Node.ANY, chaten)).toList().size());
    assertEquals(1, m.find(new Triple(Node.ANY, Node.ANY, chatEN)).toList().size());
}
Also used : GraphHelper.memGraph(org.apache.jena.testing_framework.GraphHelper.memGraph) ContractTest(org.xenei.junit.contract.ContractTest)

Example 33 with ContractTest

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

the class GraphContractTest method testFind_Node_Node_Node_ByFluidTriple.

@ContractTest
public void testFind_Node_Node_Node_ByFluidTriple() {
    Node x = node("x");
    Node y = node("y");
    Node z = node("z");
    Graph g = graphWith(producer.newInstance(), "x y z ");
    Set<Triple> expect = tripleSet("x y z");
    assertEquals(expect, g.find(Node.ANY, y, z).toSet());
    assertEquals(expect, g.find(x, Node.ANY, z).toSet());
    assertEquals(expect, g.find(x, y, Node.ANY).toSet());
}
Also used : GraphHelper.memGraph(org.apache.jena.testing_framework.GraphHelper.memGraph) ContractTest(org.xenei.junit.contract.ContractTest)

Example 34 with ContractTest

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

the class GraphMakerContractTest method testCanOpenUncreated.

/**
	 * Test that we *can* open a graph that hasn't been created
	 */
@ContractTest
public void testCanOpenUncreated() {
    String name = jName("willBeCreated");
    Graph g1 = graphMaker.openGraph(name);
    g1.close();
    graphMaker.openGraph(name, true);
}
Also used : Graph(org.apache.jena.graph.Graph) ContractTest(org.xenei.junit.contract.ContractTest)

Example 35 with ContractTest

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

the class GraphContractTest method testContains_Node_Node_Node_Concrete.

@ContractTest
public void testContains_Node_Node_Node_Concrete() {
    Node s = node("s");
    Node P = node("P");
    Node o = node("o");
    Node _x = node("_x");
    Node _R = node("_R");
    Node _y = node("_y");
    Node x = node("x");
    Node S = node("S");
    Graph g = graphWith(producer.newInstance(), "s P o; _x _R _y; x S 0");
    assertTrue("Graph should have contained s P o", g.contains(s, P, o));
    assertTrue("Graph should have contained _x _R _y", g.contains(_x, _R, _y));
    assertTrue("Graph should have contained x S 'O'", g.contains(x, S, node("0")));
    /* */
    assertFalse(g.contains(s, P, node("Oh")));
    assertFalse(g.contains(S, P, node("O")));
    assertFalse(g.contains(s, node("p"), o));
    assertFalse(g.contains(_x, node("_r"), _y));
    assertFalse(g.contains(x, S, node("1")));
}
Also used : GraphHelper.memGraph(org.apache.jena.testing_framework.GraphHelper.memGraph) 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