@Test
    public void testInconsistentState() throws ParseException {
        int db = 16;
        BucketIdFactory idFactory = new BucketIdFactory();
        ProgressToken p = new ProgressToken();

        VisitorIterator iter = VisitorIterator.createFromDocumentSelection(
                "id.group != \"yahoo.com\"", idFactory, db, p);

        // For this test, have 3 finished bucket, 2 pending and 1 active
        for (int i = 0; i < 3; ++i) {
            iter.update(iter.getNext().getSuperbucket(), ProgressToken.FINISHED_BUCKET);
        }

        VisitorIterator.BucketProgress[] bpp = new VisitorIterator.BucketProgress[2];
        bpp[0] = iter.getNext();
        bpp[1] = iter.getNext();
        VisitorIterator.BucketProgress bpa = iter.getNext(); // Leave this hanging as active
        iter.update(bpp[0].getSuperbucket(), new BucketId());
        iter.update(bpp[1].getSuperbucket(), new BucketId());

        assertFalse(p.isInconsistentState());
        iter.setDistributionBitCount(20);
        assertTrue(p.isInconsistentState());

        // Finish active, triggering the consistency fixes
        iter.update(bpa.getSuperbucket(), ProgressToken.FINISHED_BUCKET);

        assertFalse(p.isInconsistentState());
    }
Test increasing the distribution bits for a full bucket space range
source with no finished, active or pending buckets
@throws ParseException upon docsel parse failure (shouldn't happen)
documentapi/src/test/java/com/yahoo/documentapi/VisitorIteratorTestCase.java