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 });
}
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());
}
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());
}
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);
}
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")));
}
Aggregations