@Test
public void removeBranchWithQuadsTest() throws Exception {

    // Setup:
    Resource quadVersionedRecordId = VALUE_FACTORY.createIRI(RECORDS + "quad-versioned-rdf-record");
    IRI branchToRemove = VALUE_FACTORY.createIRI(BRANCHES + "quad-branch");
    Resource commit2 = VALUE_FACTORY.createIRI(COMMITS + "quad-test2");
    Resource revisionToRemove = VALUE_FACTORY.createIRI(REVISIONS + "revision2");
    IRI additionsToRemove = VALUE_FACTORY.createIRI(ADDITIONS + "quad-test2");
    IRI deletionsToRemove = VALUE_FACTORY.createIRI(DELETIONS + "quad-test2");
    IRI graphAdditionsToRemove = VALUE_FACTORY.createIRI(ADDITIONS + "quad-test2%00http%3A%2F%2Fmobi.com%2Ftest%2Fgraphs%23quad-graph1");
    IRI graphDeletionsToRemove = VALUE_FACTORY.createIRI(DELETIONS + "quad-test2%00http%3A%2F%2Fmobi.com%2Ftest%2Fgraphs%23quad-graph1");
    Branch branch = branchFactory.createNew(branchToRemove);
    branch.setHead(commitFactory.createNew(commit2));
    try (RepositoryConnection conn = repo.getConnection()) {
        assertTrue(conn.getStatements(quadVersionedRecordId, BRANCH_CATALOG_IRI, branchToRemove, quadVersionedRecordId).hasNext());
        assertTrue(conn.getStatements(commit2, typeIRI, COMMIT_CATALOG_IRI, commit2).hasNext());
        assertTrue(conn.getStatements(revisionToRemove, ADDITIONS_CATALOG_IRI, additionsToRemove, commit2).hasNext());
        assertTrue(conn.getStatements(revisionToRemove, DELETIONS_CATALOG_IRI, deletionsToRemove, commit2).hasNext());
        assertTrue(conn.getStatements(null, null, null, graphAdditionsToRemove).hasNext());
        assertTrue(conn.getStatements(null, null, null, graphDeletionsToRemove).hasNext());
        List<Resource> deletedCommits = service.removeBranch(quadVersionedRecordId, branchToRemove, conn);
        assertEquals(1, deletedCommits.size());
        assertEquals(commit2, deletedCommits.get(0));
        assertFalse(conn.getStatements(quadVersionedRecordId, BRANCH_CATALOG_IRI, branchToRemove, quadVersionedRecordId).hasNext());
        assertFalse(conn.getStatements(commit2, typeIRI, COMMIT_CATALOG_IRI, commit2).hasNext());
        assertFalse(conn.getStatements(revisionToRemove, ADDITIONS_CATALOG_IRI, additionsToRemove, commit2).hasNext());
        assertFalse(conn.getStatements(revisionToRemove, DELETIONS_CATALOG_IRI, deletionsToRemove, commit2).hasNext());
        assertFalse(conn.getStatements(null, null, null, graphAdditionsToRemove).hasNext());
        assertFalse(conn.getStatements(null, null, null, graphDeletionsToRemove).hasNext());
    }
}