@Test
void shouldShowExceptionMessageIfAffectedFileIsNotReadable() throws IOException {

    JenkinsFacade jenkins = mock(JenkinsFacade.class);
    BuildFolderFacade buildFolder = mock(BuildFolderFacade.class);
    when(buildFolder.readFile(any(), anyString(), any())).thenThrow(new IOException("file error"));
    DetailFactory detailFactory = new DetailFactory(jenkins, buildFolder);
    Report report = new Report();
    IssueBuilder issueBuilder = new IssueBuilder();
    issueBuilder.setFileName("a-file");
    Issue issue = issueBuilder.build();
    report.add(issue);
    Object details = detailFactory.createTrendDetails("source." + issue.getId().toString(),
            RUN, createResult(), report, NEW_ISSUES, OUTSTANDING_ISSUES, FIXED_ISSUES, ENCODING, createParent());
    assertThat(details).isInstanceOf(SourceDetail.class);
    assertThat(((SourceDetail) details).getSourceCode()).contains("IOException: file error");
}