@Test
    public void testActiveUpdate() throws ParseException {
        BucketIdFactory idFactory = new BucketIdFactory();
        ProgressToken progress = new ProgressToken();

        VisitorIterator iter = VisitorIterator.createFromDocumentSelection(
                "id.group = \"yahoo.com\"", idFactory, 16, progress);

        VisitorIterator.BucketProgress bp = iter.getNext();

        assertEquals(progress.getPendingBucketCount(), 0);
        assertEquals(progress.getActiveBucketCount(), 1);

        BucketId superbucket = bp.getSuperbucket();
        int usedBits = superbucket.getUsedBits();

        iter.update(superbucket, new BucketId(usedBits + 2, superbucket.getId() | (2L << usedBits)));
        assertEquals(progress.getPendingBucketCount(), 1);
        assertEquals(progress.getActiveBucketCount(), 0);
        iter.update(superbucket, new BucketId(usedBits + 2, superbucket.getId() | (1L << usedBits)));
        assertEquals(progress.getPendingBucketCount(), 1);
        assertEquals(progress.getActiveBucketCount(), 0);

        bp = iter.getNext();
        assertEquals(bp.getSuperbucket(), superbucket);
        assertEquals(bp.getProgress(), new BucketId(usedBits + 2, superbucket.getId() | (1L << usedBits)));
        assertEquals(progress.getPendingBucketCount(), 0);
        assertEquals(progress.getActiveBucketCount(), 1);
    }
Test that doing update() on a bucket several times in a row (without re-fetching
from getNext first) works
documentapi/src/test/java/com/yahoo/documentapi/VisitorIteratorTestCase.java