PropertyStatistics { public long getCount(final String key) { return getReportFor(key).size(); } 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 shouldReturnCountEmpty() { PropertyStatistics statistics = new PropertyStatistics(new Report(), "category", Function.identity()); String key = KEY; assertThatThrownBy(() -> statistics.getCount(key)) .isInstanceOf(NoSuchElementException.class) .hasMessageContaining(key); }
@Test void shouldReturnCountOne() { Report issues = new Report(); IssueBuilder builder = new IssueBuilder(); issues.add(builder.setCategory(KEY).build()); PropertyStatistics statistics = new PropertyStatistics(issues, "category", Function.identity()); long value = statistics.getCount(KEY); assertThat(value).isEqualTo(1); }
@Test void shouldReturnCountThree() { Report issues = new Report(); IssueBuilder builder = new IssueBuilder(); issues.add(builder.setCategory(KEY).build()); issues.add(builder.setCategory(KEY).setPackageName("P1").build()); issues.add(builder.setCategory(KEY).setPackageName("P2").build()); issues.add(builder.setCategory("key1").setPackageName("P1").build()); PropertyStatistics statistics = new PropertyStatistics(issues, "category", Function.identity()); long value = statistics.getCount(KEY); assertThat(value).isEqualTo(3); }