@Test
    public void testMessageParameters() {
        MockSender sender = new MockSender();
        MockReceiver receiver = new MockReceiver();
        MockAsyncTaskExecutor executor = new MockAsyncTaskExecutor();
        // Test all parameters that can be forwarded except bucketsToVisit,
        // which is already explicitly tested in testSendSingleCreateVisitor().
        VisitorParameters params = new VisitorParameters("");
        params.setDocumentSelection("id.user=5678");
        params.setFromTimestamp(9001);
        params.setToTimestamp(10001);
        params.setVisitorLibrary("CoolVisitor");
        params.setLibraryParameter("groovy", "dudes");
        params.setLibraryParameter("ninja", "turtles");
        params.setMaxBucketsPerVisitor(55);
        params.setPriority(DocumentProtocol.Priority.HIGHEST);
        params.setRoute("extraterrestrial/highway");
        params.setTimeoutMs(1337);
        params.setMaxPending(111);
        params.setFieldSet(DocIdOnly.NAME);
        params.setVisitRemoves(true);
        params.setVisitInconsistentBuckets(true);
        params.setTraceLevel(9);

        MessageBusVisitorSession visitorSession = createVisitorSession(sender, receiver, executor, params);
        visitorSession.start();

        // Process initial task which sends a single CreateVisitor.
        executor.expectAndProcessTasks(1);

        CreateVisitorMessage msg = (CreateVisitorMessage)sender.getAndRemoveMessage(0);
        assertEquals("CreateVisitorMessage(buckets=[\n" +
                "BucketId(0x800000000000162e)\n" +
                "BucketId(0x0000000000000000)\n" +
                "]\n" +
                "selection='id.user=5678'\n" +
                "time remaining=1337\n" +
                "from timestamp=9001\n" +
                "to timestamp=10001\n" +
                "max pending=111\n" +
                "fieldset=[id]\n" +
                "visit inconsistent=true\n" +
                "visit removes=true\n" +
                "parameters=[\n" +
                "groovy -> dudes\n" +
                "ninja -> turtles\n" +
                "]\n" +
                "route=extraterrestrial/highway\n" +
                "max buckets per visitor=55\n" +
                "priority=HIGHEST\n" +
                "visitor library=CoolVisitor\n" +
                "trace level=9\n" +
                ")",
                createVisitorToString(msg));

        assertFalse(msg.getRetryEnabled());
    }
Test that using an id.user=foo selection only tries to visit a single
superbucket for that user.
documentapi/src/test/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSessionTestCase.java