@Test void shouldCreateIssuesStatistics() { Run<?, ?> run = mock(Run.class); when(run.getExternalizableId()).thenReturn(REFERENCE_BUILD_ID); History history = mock(History.class); when(history.getBuild()).thenReturn(Optional.of(run)); Issue issue = getIssue("issue"); Issue fixedIssue = getIssue("fixedIssue"); Issue newIssue = getIssue("newIssue"); Issue error = getIssueWithSeverity("error", Severity.ERROR); Report referenceIssues = new Report(); referenceIssues.add(issue); referenceIssues.add(fixedIssue); when(history.getIssues()).thenReturn(referenceIssues); Report report = new Report(); report.add(issue); report.add(newIssue); report.add(error); IssuesStatistics compareIssuesStatistics = new IssuesStatisticsBuilder() .setTotalNormalSize(2) .setTotalErrorSize(1) .setNewNormalSize(1) .setNewErrorSize(1) .setDeltaErrorSize(1) .setFixedSize(1) .build(); DeltaReport deltaReport = new DeltaReport(report, history, 0); IssuesStatistics issuesStatistics = deltaReport.getStatistics(); IssuesStatisticsAssert.assertThat(issuesStatistics) .isNotNull() .isEqualToComparingFieldByField(compareIssuesStatistics); }
public IssuesStatistics getStatistics() { IssuesStatisticsBuilder builder = new IssuesStatisticsBuilder(); builder.setTotalErrorSize(allIssues.getSizeOf(ERROR)) .setTotalHighSize(allIssues.getSizeOf(WARNING_HIGH)) .setTotalNormalSize(allIssues.getSizeOf(WARNING_NORMAL)) .setTotalLowSize(allIssues.getSizeOf(WARNING_LOW)); builder.setNewErrorSize(newIssues.getSizeOf(ERROR)) .setNewHighSize(newIssues.getSizeOf(WARNING_HIGH)) .setNewNormalSize(newIssues.getSizeOf(WARNING_NORMAL)) .setNewLowSize(newIssues.getSizeOf(WARNING_LOW)); builder.setFixedSize(fixedIssues.size()); if (!referenceBuildId.isEmpty()) { builder.setDeltaErrorSize(allIssues.getSizeOf(ERROR) - referenceIssues.getSizeOf(ERROR)) .setDeltaHighSize(allIssues.getSizeOf(WARNING_HIGH) - referenceIssues.getSizeOf(WARNING_HIGH)) .setDeltaNormalSize(allIssues.getSizeOf(WARNING_NORMAL) - referenceIssues.getSizeOf(WARNING_NORMAL)) .setDeltaLowSize(allIssues.getSizeOf(WARNING_LOW) - referenceIssues.getSizeOf(WARNING_LOW)); } return builder.build(); }
DeltaReport { public IssuesStatistics getStatistics() { IssuesStatisticsBuilder builder = new IssuesStatisticsBuilder(); builder.setTotalErrorSize(allIssues.getSizeOf(ERROR)) .setTotalHighSize(allIssues.getSizeOf(WARNING_HIGH)) .setTotalNormalSize(allIssues.getSizeOf(WARNING_NORMAL)) .setTotalLowSize(allIssues.getSizeOf(WARNING_LOW)); builder.setNewErrorSize(newIssues.getSizeOf(ERROR)) .setNewHighSize(newIssues.getSizeOf(WARNING_HIGH)) .setNewNormalSize(newIssues.getSizeOf(WARNING_NORMAL)) .setNewLowSize(newIssues.getSizeOf(WARNING_LOW)); builder.setFixedSize(fixedIssues.size()); if (!referenceBuildId.isEmpty()) { builder.setDeltaErrorSize(allIssues.getSizeOf(ERROR) - referenceIssues.getSizeOf(ERROR)) .setDeltaHighSize(allIssues.getSizeOf(WARNING_HIGH) - referenceIssues.getSizeOf(WARNING_HIGH)) .setDeltaNormalSize(allIssues.getSizeOf(WARNING_NORMAL) - referenceIssues.getSizeOf(WARNING_NORMAL)) .setDeltaLowSize(allIssues.getSizeOf(WARNING_LOW) - referenceIssues.getSizeOf(WARNING_LOW)); } return builder.build(); } }
DeltaReport { public IssuesStatistics getStatistics() { IssuesStatisticsBuilder builder = new IssuesStatisticsBuilder(); builder.setTotalErrorSize(allIssues.getSizeOf(ERROR)) .setTotalHighSize(allIssues.getSizeOf(WARNING_HIGH)) .setTotalNormalSize(allIssues.getSizeOf(WARNING_NORMAL)) .setTotalLowSize(allIssues.getSizeOf(WARNING_LOW)); builder.setNewErrorSize(newIssues.getSizeOf(ERROR)) .setNewHighSize(newIssues.getSizeOf(WARNING_HIGH)) .setNewNormalSize(newIssues.getSizeOf(WARNING_NORMAL)) .setNewLowSize(newIssues.getSizeOf(WARNING_LOW)); builder.setFixedSize(fixedIssues.size()); if (!referenceBuildId.isEmpty()) { builder.setDeltaErrorSize(allIssues.getSizeOf(ERROR) - referenceIssues.getSizeOf(ERROR)) .setDeltaHighSize(allIssues.getSizeOf(WARNING_HIGH) - referenceIssues.getSizeOf(WARNING_HIGH)) .setDeltaNormalSize(allIssues.getSizeOf(WARNING_NORMAL) - referenceIssues.getSizeOf(WARNING_NORMAL)) .setDeltaLowSize(allIssues.getSizeOf(WARNING_LOW) - referenceIssues.getSizeOf(WARNING_LOW)); } return builder.build(); } DeltaReport(final Report report, final History history, final int currentBuildNumber); }
DeltaReport { public IssuesStatistics getStatistics() { IssuesStatisticsBuilder builder = new IssuesStatisticsBuilder(); builder.setTotalErrorSize(allIssues.getSizeOf(ERROR)) .setTotalHighSize(allIssues.getSizeOf(WARNING_HIGH)) .setTotalNormalSize(allIssues.getSizeOf(WARNING_NORMAL)) .setTotalLowSize(allIssues.getSizeOf(WARNING_LOW)); builder.setNewErrorSize(newIssues.getSizeOf(ERROR)) .setNewHighSize(newIssues.getSizeOf(WARNING_HIGH)) .setNewNormalSize(newIssues.getSizeOf(WARNING_NORMAL)) .setNewLowSize(newIssues.getSizeOf(WARNING_LOW)); builder.setFixedSize(fixedIssues.size()); if (!referenceBuildId.isEmpty()) { builder.setDeltaErrorSize(allIssues.getSizeOf(ERROR) - referenceIssues.getSizeOf(ERROR)) .setDeltaHighSize(allIssues.getSizeOf(WARNING_HIGH) - referenceIssues.getSizeOf(WARNING_HIGH)) .setDeltaNormalSize(allIssues.getSizeOf(WARNING_NORMAL) - referenceIssues.getSizeOf(WARNING_NORMAL)) .setDeltaLowSize(allIssues.getSizeOf(WARNING_LOW) - referenceIssues.getSizeOf(WARNING_LOW)); } return builder.build(); } DeltaReport(final Report report, final History history, final int currentBuildNumber); boolean isEmpty(); String getReferenceBuildId(); Report getAllIssues(); Report getOutstandingIssues(); Report getNewIssues(); Report getFixedIssues(); IssuesStatistics getStatistics(); }
DeltaReport { public IssuesStatistics getStatistics() { IssuesStatisticsBuilder builder = new IssuesStatisticsBuilder(); builder.setTotalErrorSize(allIssues.getSizeOf(ERROR)) .setTotalHighSize(allIssues.getSizeOf(WARNING_HIGH)) .setTotalNormalSize(allIssues.getSizeOf(WARNING_NORMAL)) .setTotalLowSize(allIssues.getSizeOf(WARNING_LOW)); builder.setNewErrorSize(newIssues.getSizeOf(ERROR)) .setNewHighSize(newIssues.getSizeOf(WARNING_HIGH)) .setNewNormalSize(newIssues.getSizeOf(WARNING_NORMAL)) .setNewLowSize(newIssues.getSizeOf(WARNING_LOW)); builder.setFixedSize(fixedIssues.size()); if (!referenceBuildId.isEmpty()) { builder.setDeltaErrorSize(allIssues.getSizeOf(ERROR) - referenceIssues.getSizeOf(ERROR)) .setDeltaHighSize(allIssues.getSizeOf(WARNING_HIGH) - referenceIssues.getSizeOf(WARNING_HIGH)) .setDeltaNormalSize(allIssues.getSizeOf(WARNING_NORMAL) - referenceIssues.getSizeOf(WARNING_NORMAL)) .setDeltaLowSize(allIssues.getSizeOf(WARNING_LOW) - referenceIssues.getSizeOf(WARNING_LOW)); } return builder.build(); } DeltaReport(final Report report, final History history, final int currentBuildNumber); boolean isEmpty(); String getReferenceBuildId(); Report getAllIssues(); Report getOutstandingIssues(); Report getNewIssues(); Report getFixedIssues(); IssuesStatistics getStatistics();  }