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

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

        assertEquals(progress.getPendingBucketCount(), 1);

        VisitorIterator.BucketProgress bp = iter.getNext();
        assertEquals(bp.getProgress(), new BucketId());
        BucketId superbucket = bp.getSuperbucket();
        BucketId sub = bp.getProgress();

        assertFalse(iter.hasNext());
        assertFalse(iter.isDone());
        assertEquals(progress.getPendingBucketCount(), 0);
        assertEquals(progress.getActiveBucketCount(), 1);

        // 0-bucket
        iter.update(superbucket, ProgressToken.NULL_BUCKET);
        assertTrue(iter.hasNext());
        assertFalse(iter.isDone());
        assertEquals(progress.getPendingBucketCount(), 1);
        assertEquals(progress.getActiveBucketCount(), 0);

        VisitorIterator.BucketProgress bp2 = iter.getNext();
        assertEquals(bp2.getSuperbucket(), superbucket);
        assertEquals(bp2.getProgress(), ProgressToken.NULL_BUCKET);
        assertEquals(progress.getPendingBucketCount(), 0);
        assertEquals(progress.getActiveBucketCount(), 1);

        // progress == super
        iter.update(superbucket, superbucket);
        assertTrue(iter.hasNext());
        assertFalse(iter.isDone());
        assertEquals(progress.getPendingBucketCount(), 1);
        assertEquals(progress.getActiveBucketCount(), 0);

        bp2 = iter.getNext();
        assertEquals(bp2.getSuperbucket(), superbucket);
        assertEquals(bp2.getProgress(), superbucket);
        assertEquals(progress.getPendingBucketCount(), 0);
        assertEquals(progress.getActiveBucketCount(), 1);
    }
Test that ensures doing update(superbucket, 0) simply puts the bucket back in
pending
documentapi/src/test/java/com/yahoo/documentapi/VisitorIteratorTestCase.java