FilePairOcurrencesGroup { public void groupFilePairs(Collection<FilePairReleasesOccurenceCounter> counters, int minOccurrencesInAnyVersion) { for (FilePairReleasesOccurenceCounter counter : counters) { if (counter.hasAtLeastOccurrencesInOneVersion(minOccurrencesInAnyVersion)) { for (FilterFilePairByReleaseOcurrence group : groupingCount.keySet()) { if (group.fits(counter)) { increment(group); } } } } } FilePairOcurrencesGroup();  FilePairOcurrencesGroup(Collection<FilterFilePairByReleaseOcurrence> filterList); void addFilterFilePair(FilterFilePairByReleaseOcurrence filter); int getQuantity(FilterFilePairByReleaseOcurrence filter); void groupFilePairs(Collection<FilePairReleasesOccurenceCounter> counters, int minOccurrencesInAnyVersion); void groupFilePairs(List<Version> allVersions,
            Collection<FilePairReleasesOccurenceCounter> counters, int minOccurrencesInOneVersion); @Override String toString(); String getDynamicHeader();  }
@Test public void testGroupFilePairs() { final List<FilterFilePairByReleaseOcurrence> filterSuggestion = new ArrayList<>(FilterFilePairByReleaseOcurrence.getSuggestedFilters()); filterSuggestion.add(new FilterFilePairByReleaseOcurrence(2, 3)); FilePairOcurrencesGroup group = new FilePairOcurrencesGroup(filterSuggestion); final List<FilePairReleasesOccurenceCounter> filePairOcurrencesCounter = new ArrayList<>(); final FilePairReleasesOccurenceCounter ab = new FilePairReleasesOccurenceCounter(new FilePair("A", "B")); ab.addVersionOccurrence(new Version("1.0")); ab.addVersionOccurrence(new Version("1.1")); ab.addVersionOccurrence(new Version("1.2")); filePairOcurrencesCounter.add(ab); final FilePairReleasesOccurenceCounter bc = new FilePairReleasesOccurenceCounter(new FilePair("B", "c")); bc.addVersionOccurrence(new Version("1.0")); bc.addVersionOccurrence(new Version("1.1")); bc.addVersionOccurrence(new Version("1.2")); filePairOcurrencesCounter.add(bc); final FilePairReleasesOccurenceCounter cd = new FilePairReleasesOccurenceCounter(new FilePair("C", "D")); cd.addVersionOccurrence(new Version("1.1")); cd.addVersionOccurrence(new Version("1.2")); filePairOcurrencesCounter.add(cd); final FilePairReleasesOccurenceCounter de = new FilePairReleasesOccurenceCounter(new FilePair("D", "E")); de.addVersionOccurrence(new Version("1.1")); de.addVersionOccurrence(new Version("1.2")); de.addVersionOccurrence(new Version("1.3")); de.addVersionOccurrence(new Version("1.4")); filePairOcurrencesCounter.add(de); group.groupFilePairs(filePairOcurrencesCounter, 1); Assert.assertEquals(1, group.getQuantity(new FilterFilePairByReleaseOcurrence(2, 2))); Assert.assertEquals(2, group.getQuantity(new FilterFilePairByReleaseOcurrence(3, 3))); Assert.assertEquals(1, group.getQuantity(new FilterFilePairByReleaseOcurrence(4, 4))); Assert.assertEquals(0, group.getQuantity(new FilterFilePairByReleaseOcurrence(5))); Assert.assertEquals(3, group.getQuantity(new FilterFilePairByReleaseOcurrence(2, 3))); Assert.assertEquals("1;2;1;0;3", group.toString()); Assert.assertEquals("in 2 releases;in 3 releases;in 4 releases;>= 5 releases;in 2-3 releases", group.getDynamicHeader()); }