protected TaskExecutionContext buildTaskContext(DefaultGoPublisher publisher,
                                                    EnvironmentVariableContext environmentVariableContext, Charset consoleLogCharset) {

        CompositeConsumer errorStreamConsumer = new CompositeConsumer(CompositeConsumer.ERR,  publisher);
        CompositeConsumer outputStreamConsumer = new CompositeConsumer(CompositeConsumer.OUT,  publisher);
        SafeOutputStreamConsumer safeOutputStreamConsumer = new SafeOutputStreamConsumer(new ProcessOutputStreamConsumer<>(errorStreamConsumer, outputStreamConsumer));
        safeOutputStreamConsumer.addSecrets(environmentVariableContext.secrets());
        return new PluggableTaskContext(safeOutputStreamConsumer, environmentVariableContext, workingDir, consoleLogCharset);
    }
@Test
    public void shouldReturnPluggableTaskContext() {
        PluggableTask task = mock(PluggableTask.class);
        when(task.getPluginConfiguration()).thenReturn(new PluginConfiguration());

        String workingDir = "test-directory";
        PluggableTaskBuilder taskBuilder = new PluggableTaskBuilder(runIfConfigs, cancelBuilder, task, TEST_PLUGIN_ID, workingDir);
        TaskExecutionContext taskExecutionContext = taskBuilder.buildTaskContext(goPublisher, variableContext, UTF_8);

        assertThat(taskExecutionContext instanceof PluggableTaskContext).isEqualTo(true);
        assertThat(taskExecutionContext.workingDir()).isEqualTo(workingDir);
    }