Search in sources :

Example 1 with TrackingTripleIterator

use of org.apache.jena.mem.TrackingTripleIterator in project jena by apache.

the class GraphContractTest method failingTestDoubleRemoveAll.

@ContractTest
public void failingTestDoubleRemoveAll() {
    final Graph g = producer.newInstance();
    try {
        graphAddTxn(g, "c S d; e:ff GGG hhhh; _i J 27; Ell Em 'en'");
        Iterator<Triple> it = new TrackingTripleIterator(g.find(Triple.ANY)) {

            @Override
            public void remove() {
                // removes current
                super.remove();
                // no-op.
                g.delete(current);
            }
        };
        while (it.hasNext()) {
            it.next();
            it.remove();
        }
        assertTrue(g.isEmpty());
    } catch (UnsupportedOperationException e) {
    // No Iterator.remove
    }
}
Also used : GraphHelper.memGraph(org.apache.jena.testing_framework.GraphHelper.memGraph) TrackingTripleIterator(org.apache.jena.mem.TrackingTripleIterator) ContractTest(org.xenei.junit.contract.ContractTest)

Aggregations

TrackingTripleIterator (org.apache.jena.mem.TrackingTripleIterator)1 GraphHelper.memGraph (org.apache.jena.testing_framework.GraphHelper.memGraph)1 ContractTest (org.xenei.junit.contract.ContractTest)1