use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class GraphContractTest method testFind_Node_Node_Node_MatchLanguagedLiteralCaseInsensitive.
@ContractTest
public void testFind_Node_Node_Node_MatchLanguagedLiteralCaseInsensitive() {
Graph m = graphWith(producer.newInstance(), "a p 'chat'en");
if (m.getCapabilities().handlesLiteralTyping()) {
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(Node.ANY, Node.ANY, chaten).toList().size());
assertEquals(1, m.find(Node.ANY, Node.ANY, chatEN).toList().size());
}
}
use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class GraphContractTest method testBrokenPredicate.
@ContractTest
public void testBrokenPredicate() {
Graph g = graphWith(producer.newInstance(), "x brokenPredicate y");
try {
ExtendedIterator<Triple> it = g.find(Node.ANY, node("brokenPredicate"), Node.ANY);
it.removeNext();
assertFalse(g.find(Node.ANY, Node.ANY, Node.ANY).hasNext());
} catch (UnsupportedOperationException e) {
// No Iterator.remove
}
}
use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class GraphContractTest method testDependsOn.
@ContractTest
public void testDependsOn() {
Graph g = producer.newInstance();
Graph[] depGraphs = producer.getDependsOn(g);
if (depGraphs != null) {
for (Graph dg : depGraphs) {
assertTrue(String.format("Graph %s should depend upon %s", g, dg), g.dependsOn(dg));
}
}
depGraphs = producer.getNotDependsOn(g);
if (depGraphs != null) {
for (Graph dg : depGraphs) {
assertFalse(String.format("Graph %s should not depend upon %s", g, dg), g.dependsOn(dg));
}
}
}
use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class GraphContractTest method testBrokenIndexes.
@ContractTest
public void testBrokenIndexes() {
Graph g = graphWith(producer.newInstance(), "x R y; x S z");
try {
ExtendedIterator<Triple> it = g.find(Node.ANY, Node.ANY, Node.ANY);
it.removeNext();
it.removeNext();
assertFalse(g.find(node("x"), Node.ANY, Node.ANY).hasNext());
assertFalse(g.find(Node.ANY, node("R"), Node.ANY).hasNext());
assertFalse(g.find(Node.ANY, Node.ANY, node("y")).hasNext());
} catch (UnsupportedOperationException e) {
// No Iterator.remove
}
}
use of org.xenei.junit.contract.ContractTest in project jena by apache.
the class GraphContractTest method testFind_Triple_NoMatchAgainstUnlanguagesLiteral.
@ContractTest
public void testFind_Triple_NoMatchAgainstUnlanguagesLiteral() {
Graph m = graphWith(producer.newInstance(), "a p 'chat'en; a p 'chat'");
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());
}
Aggregations