@Override
    public void prepare() {
        try {
            PluggableSCMMaterial material = (PluggableSCMMaterial) revision.getMaterial();
            Modification latestModification = revision.getLatestModification();
            SCMRevision scmRevision = new SCMRevision(latestModification.getRevision(), latestModification.getModifiedTime(), null, null, latestModification.getAdditionalDataMap(), null);
            File destinationFolder = material.workingDirectory(workingDirectory);
            Result result = scmExtension.checkout(material.getScmConfig().getPluginConfiguration().getId(), buildSCMPropertyConfigurations(material.getScmConfig()), destinationFolder.getAbsolutePath(), scmRevision);
            handleCheckoutResult(material, result);
        } catch (Exception e) {
            consumer.taggedErrOutput(PREP_ERR, String.format("Material %s checkout failed: %s", revision.getMaterial().getDisplayName(), e.getMessage()));
            throw e;
        }
    }
@Test
    void shouldLogToStdOutWhenPluginSendsCheckoutResultWithSuccessMessages() {
        SCM scmConfig = SCMMother.create("scm-id", "scm-name", "pluginid", "version", new Configuration());
        PluggableSCMMaterial pluggableSCMMaterial = MaterialsMother.pluggableSCMMaterial();
        pluggableSCMMaterial.setFolder("destination-folder");
        pluggableSCMMaterial.setSCMConfig(scmConfig);
        Modification modification = ModificationsMother.oneModifiedFile("r1");
        Map<String, String> additionalData = new HashMap<>();
        additionalData.put("a1", "v1");
        additionalData.put("a2", "v2");
        modification.setAdditionalData(new Gson().toJson(additionalData));
        MaterialRevision revision = new MaterialRevision(pluggableSCMMaterial, modification);
        String pipelineFolder = new File(System.getProperty("java.io.tmpdir")).getAbsolutePath();
        String destinationFolder = new File(pipelineFolder, "destination-folder").getAbsolutePath();

        PluggableSCMMaterialAgent pluggableSCMMaterialAgent = new PluggableSCMMaterialAgent(scmExtension, revision, new File(pipelineFolder), consumer);
        when(scmExtension.checkout(eq("pluginid"), any(), eq(destinationFolder), any()))
                .thenReturn(new Result().withSuccessMessages("Material scm-name is updated."));

        pluggableSCMMaterialAgent.prepare();

        verify(consumer, times(1)).stdOutput("Material scm-name is updated.");
    }