protected ExecutionResult executeTask(Task task,
                                          DefaultGoPublisher publisher,
                                          EnvironmentVariableContext environmentVariableContext, Charset consoleLogCharset) {
        final TaskExecutionContext taskExecutionContext = buildTaskContext(publisher, environmentVariableContext, consoleLogCharset);
        JobConsoleLoggerInternal.setContext(taskExecutionContext);

        TaskConfig config = buildTaskConfig(task.config());
        return task.executor().execute(config, taskExecutionContext);
    }
@Test
    public void shouldBuildExecutorConfigPlusExecutionContextAndInvokeTheTaskExecutorWithIt() {
        Task task = mock(Task.class);

        TaskConfig defaultTaskConfig = mock(TaskConfig.class);
        when(task.config()).thenReturn(defaultTaskConfig);

        final TaskConfig executorTaskConfig = mock(TaskConfig.class);
        final TaskExecutionContext taskExecutionContext = mock(TaskExecutionContext.class);
        PluggableTaskBuilder taskBuilder = new PluggableTaskBuilder(runIfConfigs, cancelBuilder, pluggableTask, TEST_PLUGIN_ID, "test-directory") {
            @Override
            protected TaskConfig buildTaskConfig(TaskConfig config) {
                return executorTaskConfig;
            }

            @Override
            protected TaskExecutionContext buildTaskContext(DefaultGoPublisher publisher, EnvironmentVariableContext environmentVariableContext, Charset consoleLogCharset) {
                return taskExecutionContext;
            }
        };

        TaskExecutor taskExecutor = mock(TaskExecutor.class);
        when(taskExecutor.execute(executorTaskConfig, taskExecutionContext)).thenReturn(new ExecutionResult());
        when(task.executor()).thenReturn(taskExecutor);

        taskBuilder.executeTask(task, null, null, UTF_8);

        verify(task).config();
        verify(task).executor();
        verify(taskExecutor).execute(executorTaskConfig, taskExecutionContext);

        assertThat((TaskExecutionContext) ReflectionUtil.getStaticField(JobConsoleLogger.class, "context")).isNotNull();
    }