@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);
}