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

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

        VisitorIterator.BucketProgress[] bpp = new VisitorIterator.BucketProgress[3];

        for (int i = 0; i < 3; ++i) {
            bpp[i] = iter.getNext();
        }
        for (int i = 0; i < 3; ++i) {
            // Must use non-zero progress or all pending will be optimized
            // away by the reset-logic
            iter.update(bpp[i].getSuperbucket(),
                    new BucketId(db + 1, bpp[i].getSuperbucket().getId()));
        }

        Set<BucketId> buckets = new TreeSet<BucketId>();
        db = 7;
        for (int i = 0; i < (1 << db); ++i) {
            buckets.add(new BucketId(db, i));
        }

        iter.setDistributionBitCount(db);
        assertEquals(p.getFinishedBucketCount(), 0);
        assertEquals(p.getPendingBucketCount(), 3 << 3);

        // Ensure all buckets are visited once and only once
        while (iter.hasNext()) {
            VisitorIterator.BucketProgress bp = iter.getNext();
            assertTrue(buckets.contains(bp.getSuperbucket()));
            buckets.remove(bp.getSuperbucket());
        }

        assertTrue(buckets.isEmpty());
    }
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