@Test
    public void testInvalidSlicing() throws ParseException {
        int distBits = 4;
        BucketIdFactory idFactory = new BucketIdFactory();
        ProgressToken progress = new ProgressToken();

        try {
            VisitorIterator.createFromDocumentSelection(
                    "id.group != \"yahoo.com\"", idFactory, distBits, progress, 0, 0);
        }
        catch (IllegalArgumentException e) {
            assertEquals("slices must be positive, but was 0", e.getMessage());
        }

        try {
            VisitorIterator.createFromDocumentSelection(
                    "id.group != \"yahoo.com\"", idFactory, distBits, progress, 1, 1);
        }
        catch (IllegalArgumentException e) {
            assertEquals("sliceId must be in [0, 1), but was 1", e.getMessage());
        }

        try {
            VisitorIterator.createFromDocumentSelection(
                    "id.group != \"yahoo.com\"", idFactory, distBits, progress, 1, -1);
        }
        catch (IllegalArgumentException e) {
            assertEquals("sliceId must be in [0, 1), but was -1", e.getMessage());
        }
    }
Tests for VisitorIterator and ProgressToken (kept in one test case because their
interactions are so tightly coupled)

@author vekterli
documentapi/src/test/java/com/yahoo/documentapi/VisitorIteratorTestCase.java