@Test
void shouldReportCopyExceptions() throws InterruptedException, IOException {

    AffectedFilesResolver resolver = new AffectedFilesResolver();
    Report report = new Report();
    Issue issue = new IssueBuilder().setFileName(FILE_NAME).build();
    report.add(issue);
    RemoteFacade remoteFacade = mock(RemoteFacade.class);
    when(remoteFacade.exists(FILE_NAME)).thenReturn(true);
    when(remoteFacade.isInWorkspace(FILE_NAME)).thenReturn(true);
    doThrow(IOException.class).when(remoteFacade).copy(FILE_NAME, FILE_NAME);
    resolver.copyAffectedFilesToBuildFolder(report, remoteFacade);
    assertThat(report.getErrorMessages())
            .hasSize(2)
            .contains("Can't copy some affected workspace files to Jenkins build folder:",
                    "- 'file.txt', IO exception has been thrown: java.io.IOException");
    assertThat(report.getInfoMessages()).hasSize(1);
    String message = report.getInfoMessages().get(0);
    assertThat(message).contains("0 copied");
    assertThat(message).contains("0 not in workspace");
    assertThat(message).contains("0 not-found");
    assertThat(message).contains("1 with I/O error");
}