threadContextStubFactory.assertSuccess( "getPluginThreadContext", new Object[0]); threadContextStubFactory.assertSuccess("getThreadLogger", new Object[0]); threadContextStubFactory.assertNotCalled();
  public void testGetPluginThreadListener() throws Exception {    final GrinderPluginStubFactory grinderPluginStubFactory =      new GrinderPluginStubFactory();    final GrinderPlugin grinderPlugin =      grinderPluginStubFactory.getGrinderPlugin();    final RandomStubFactory scriptContextStubFactory =      new RandomStubFactory(ScriptContext.class);    final ScriptContext scriptContext =      (ScriptContext)scriptContextStubFactory.getStub();    final ThreadContextLocator threadContextLocator =      new StubThreadContextLocator();    final RegisteredPlugin registeredPlugin =      new RegisteredPlugin(grinderPlugin, scriptContext, threadContextLocator);    try {      registeredPlugin.getPluginThreadListener();      fail("Expected EngineException");    }    catch (EngineException e) {    }    final ThreadLoggerStubFactory threadLoggerStubFactory =      new ThreadLoggerStubFactory();    final ThreadLogger threadLogger =      threadLoggerStubFactory.getThreadLogger();    final ThreadContextStubFactory threadContextStubFactory =      new ThreadContextStubFactory(threadLogger);    final ThreadContext threadContext =      threadContextStubFactory.getThreadContext();    threadContextLocator.set(threadContext);    grinderPluginStubFactory.setThrowExceptionFromCreateThreadListener(true);    try {      registeredPlugin.getPluginThreadListener();      fail("Expected EngineException");    }    catch (EngineException e) {    }    // Fix me.    grinderPluginStubFactory.setThrowExceptionFromCreateThreadListener(false);    final PluginThreadListener pluginThreadListener1 =      registeredPlugin.getPluginThreadListener();    threadContextStubFactory.assertSuccess(      "getPluginThreadContext", new Object[] {});    grinderPluginStubFactory.assertSuccess(      "createThreadListener", new Class[] { PluginThreadContext.class });    final PluginThreadListener pluginThreadListener2 =      registeredPlugin.getPluginThreadListener();    threadContextStubFactory.assertNotCalled();    grinderPluginStubFactory.assertNotCalled();    assertSame(pluginThreadListener1, pluginThreadListener2);    final PluginThreadListener pluginThreadListener3 =      registeredPlugin.getPluginThreadListener(threadContext);    assertSame(pluginThreadListener1, pluginThreadListener3);  }