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

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

        VisitorIterator.DistributionRangeBucketSource src
                = (VisitorIterator.DistributionRangeBucketSource)iter.getBucketSource();

        assertTrue(src.isLosslessResetPossible());

        // "Sabotage" resetting by having at least 1 finished
        iter.update(iter.getNext().getSuperbucket(), ProgressToken.FINISHED_BUCKET);

        VisitorIterator.BucketProgress[] bpp = new VisitorIterator.BucketProgress[4];
        for (int i = 0; i < 4; ++i) {
            bpp[i] = iter.getNext();
        }
        for (int i = 0; i < 4; ++i) {
            iter.update(bpp[i].getSuperbucket(), new BucketId());
        }

        assertFalse(src.isLosslessResetPossible());

        iter.setDistributionBitCount(20);
        assertEquals(p.getDistributionBitCount(), 20);
        assertEquals(p.getPendingBucketCount(), 4 << 4);
        assertFalse(iter.getBucketSource().shouldYield());
        assertEquals(p.getBucketCursor(), 5 << 4);

        iter.setDistributionBitCount(16);

        assertEquals(p.getDistributionBitCount(), 16);
        assertEquals(p.getPendingBucketCount(), 4);
        assertFalse(iter.getBucketSource().shouldYield());
        assertEquals(p.getBucketCursor(), 5);
    }
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