@Test
    public void testReplyErrorIfLocalDataHandlerIsNull() {
        MockComponentsBuilder builder = new MockComponentsBuilder();
        builder.params = createVisitorParameters("id.user==1234");
        builder.params.setLocalDataHandler(null);
        builder.params.setRemoteDataHandler("odyssey");
        MockComponents mc = builder.createMockComponents();

        mc.visitorSession.start();
        mc.executor.expectAndProcessTasks(1);

        mc.receiver.send(new RemoveDocumentMessage(new DocumentId("id:ns:testdoc::bar")));
        mc.executor.expectAndProcessTasks(1);

        assertEquals("RemoveDocumentReply(APP_FATAL_ERROR: Visitor data with no local data destination)\n",
                mc.receiver.repliesToString());
    }
Test that there is no race condition between a reply is handed off
to the executor service via a task (thus decrementing the pending count
for the sender) and the session checking for completion early, e.g.
because of an error transitioning it into a failure state.
documentapi/src/test/java/com/yahoo/documentapi/messagebus/MessageBusVisitorSessionTestCase.java