@Test void shouldReturnSourceDetailWhenCalledWithSourceLinkAndIssueNotInConsoleLog() throws IOException { JenkinsFacade jenkins = mock(JenkinsFacade.class); BuildFolderFacade buildFolder = mock(BuildFolderFacade.class); when(buildFolder.readFile(any(), anyString(), any())).thenReturn(new StringReader(AFFECTED_FILE_CONTENT)); 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(AFFECTED_FILE_CONTENT); }
@SuppressWarnings({"PMD.CyclomaticComplexity", "checkstyle:ParameterNumber"}) Object createTrendDetails(final String link, final Run<?, ?> owner, final AnalysisResult result, final Report allIssues, final Report newIssues, final Report outstandingIssues, final Report fixedIssues, final Charset sourceEncoding, final IssuesDetail parent) { StaticAnalysisLabelProvider labelProvider = parent.getLabelProvider(); if (link.contains(LINK_SEPARATOR)) { return createFilteredView(link, owner, result, allIssues, newIssues, outstandingIssues, fixedIssues, sourceEncoding, parent, labelProvider); } else { return createNewDetailView(link, owner, result, allIssues, newIssues, outstandingIssues, fixedIssues, sourceEncoding, parent, labelProvider); } }
DetailFactory { @SuppressWarnings({"PMD.CyclomaticComplexity", "checkstyle:ParameterNumber"}) Object createTrendDetails(final String link, final Run<?, ?> owner, final AnalysisResult result, final Report allIssues, final Report newIssues, final Report outstandingIssues, final Report fixedIssues, final Charset sourceEncoding, final IssuesDetail parent) { StaticAnalysisLabelProvider labelProvider = parent.getLabelProvider(); if (link.contains(LINK_SEPARATOR)) { return createFilteredView(link, owner, result, allIssues, newIssues, outstandingIssues, fixedIssues, sourceEncoding, parent, labelProvider); } else { return createNewDetailView(link, owner, result, allIssues, newIssues, outstandingIssues, fixedIssues, sourceEncoding, parent, labelProvider); } } }
DetailFactory { @SuppressWarnings({"PMD.CyclomaticComplexity", "checkstyle:ParameterNumber"}) Object createTrendDetails(final String link, final Run<?, ?> owner, final AnalysisResult result, final Report allIssues, final Report newIssues, final Report outstandingIssues, final Report fixedIssues, final Charset sourceEncoding, final IssuesDetail parent) { StaticAnalysisLabelProvider labelProvider = parent.getLabelProvider(); if (link.contains(LINK_SEPARATOR)) { return createFilteredView(link, owner, result, allIssues, newIssues, outstandingIssues, fixedIssues, sourceEncoding, parent, labelProvider); } else { return createNewDetailView(link, owner, result, allIssues, newIssues, outstandingIssues, fixedIssues, sourceEncoding, parent, labelProvider); } } DetailFactory(); @VisibleForTesting  DetailFactory(final JenkinsFacade jenkinsFacade, final BuildFolderFacade buildFolder); }
DetailFactory { @SuppressWarnings({"PMD.CyclomaticComplexity", "checkstyle:ParameterNumber"}) Object createTrendDetails(final String link, final Run<?, ?> owner, final AnalysisResult result, final Report allIssues, final Report newIssues, final Report outstandingIssues, final Report fixedIssues, final Charset sourceEncoding, final IssuesDetail parent) { StaticAnalysisLabelProvider labelProvider = parent.getLabelProvider(); if (link.contains(LINK_SEPARATOR)) { return createFilteredView(link, owner, result, allIssues, newIssues, outstandingIssues, fixedIssues, sourceEncoding, parent, labelProvider); } else { return createNewDetailView(link, owner, result, allIssues, newIssues, outstandingIssues, fixedIssues, sourceEncoding, parent, labelProvider); } } DetailFactory(); @VisibleForTesting  DetailFactory(final JenkinsFacade jenkinsFacade, final BuildFolderFacade buildFolder);  }
DetailFactory { @SuppressWarnings({"PMD.CyclomaticComplexity", "checkstyle:ParameterNumber"}) Object createTrendDetails(final String link, final Run<?, ?> owner, final AnalysisResult result, final Report allIssues, final Report newIssues, final Report outstandingIssues, final Report fixedIssues, final Charset sourceEncoding, final IssuesDetail parent) { StaticAnalysisLabelProvider labelProvider = parent.getLabelProvider(); if (link.contains(LINK_SEPARATOR)) { return createFilteredView(link, owner, result, allIssues, newIssues, outstandingIssues, fixedIssues, sourceEncoding, parent, labelProvider); } else { return createNewDetailView(link, owner, result, allIssues, newIssues, outstandingIssues, fixedIssues, sourceEncoding, parent, labelProvider); } } DetailFactory(); @VisibleForTesting  DetailFactory(final JenkinsFacade jenkinsFacade, final BuildFolderFacade buildFolder);   }