@Test
    public void testExceptionInHandleVisitorInfoMessage() {
        MockComponents mc = createDefaultMock("id.user==1234");
        mc.visitorSession.start();
        mc.controlHandler.resetMock();
        mc.controlHandler.setExceptionOnProgress(new IllegalArgumentException("failed bigtime"));
        mc.executor.expectAndProcessTasks(1);

        mc.receiver.send(new VisitorInfoMessage());
        mc.executor.expectAndProcessTasks(1); // Message handler task

        // Reply with OK; session should still have failed due to the processing error
        replyToCreateVisitor(mc.sender, ProgressToken.FINISHED_BUCKET);
        mc.executor.expectAndProcessTasks(1);
        mc.executor.expectNoTasks();
        assertTrue(mc.controlHandler.isDone());

        // NOTE: 1st onProgress is invoked from VisitorInfo task.
        // No onVisitorStatistics since that happens after onProgress, which throws
        assertEquals("onProgress : 1 active, 0 pending, 0 finished, 1 total\n" +
                "onProgress : 0 active, 0 pending, 1 finished, 1 total\n" +
                "onDone : FAILURE - 'Got exception of type java.lang.IllegalArgumentException " +
                "with message 'failed bigtime' while processing VisitorInfoMessage'\n",
                mc.controlHandler.toString());
        assertEquals("VisitorReply(APP_FATAL_ERROR: Got exception of type java.lang.IllegalArgumentException " +
                "with message 'failed bigtime' while processing VisitorInfoMessage)\n",
                mc.receiver.repliesToString());
    }
Test branch where we don't know how to handle a certain reply type.
This should never happen (since we only get replies for messages we've
already sent) but deal with it anyway!
documentapi/src/test/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSessionTestCase.java