PropertyStatistics { public long getLowCount(final String key) { return getReportFor(key).getSizeOf(Severity.WARNING_LOW); } PropertyStatistics(final Report report,
            final String property, final Function<String, String> propertyFormatter); int getTotal(); String getProperty(); String getDisplayName(final String key); String getToolTip(final String key); Set<String> getKeys(); int getMax(); long getCount(final String key); long getErrorsCount(final String key); long getHighCount(final String key); long getNormalCount(final String key); long getLowCount(final String key);  }
@Test void shouldReturnLowCountOne() { Report issues = new Report(); IssueBuilder builder = new IssueBuilder(); issues.add(builder.setSeverity(Severity.WARNING_LOW).setCategory(KEY).build()); PropertyStatistics statistics = new PropertyStatistics(issues, "category", Function.identity()); long value = statistics.getLowCount(KEY); assertThat(value).isEqualTo(1); }
@Test void shouldReturnLowCountException() { PropertyStatistics statistics = new PropertyStatistics(new Report(), "category", Function.identity()); assertThatThrownBy(() -> statistics.getLowCount(KEY)) .isInstanceOf(NoSuchElementException.class) .hasMessageContaining(KEY); }
@Test void shouldReturnLowCountTwo() { Report issues = new Report(); IssueBuilder builder = new IssueBuilder(); issues.add(builder.setSeverity(Severity.WARNING_LOW).setCategory(KEY).setOrigin("A").build()); issues.add(builder.setSeverity(Severity.WARNING_LOW).setCategory(KEY).setOrigin("B").build()); issues.add(builder.setSeverity(Severity.WARNING_NORMAL).setCategory(KEY).setOrigin("B").build()); issues.add(builder.setSeverity(Severity.WARNING_HIGH).setCategory(KEY).setOrigin("B").build()); PropertyStatistics statistics = new PropertyStatistics(issues, "category", Function.identity()); long value = statistics.getLowCount(KEY); assertThat(value).isEqualTo(2); }
@Test void shouldReturnLowCountZero() { Report issues = new Report(); IssueBuilder builder = new IssueBuilder(); issues.add(builder.setSeverity(Severity.WARNING_HIGH).setCategory(KEY).build()); PropertyStatistics statistics = new PropertyStatistics(issues, "category", Function.identity()); long value = statistics.getLowCount(KEY); assertThat(value).isEqualTo(0); }