HiddenBranchRefFilter implements RefFilter { @Override public Map<String, Ref> filter(final Map<String, Ref> refs) { return refs.entrySet() .stream() .filter(ref -> !HiddenBranchRefFilter.isHidden(ref.getKey())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); }  @Override Map<String, Ref> filter(final Map<String, Ref> refs); static boolean isHidden(String branch);  }
@Test public void testHiddenBranchsFiltering() { final Map<String, Ref> filteredRefs = filter.filter(refs); final Set<Map.Entry<String, Ref>> set = filteredRefs.entrySet(); assertEquals(5, set.size()); assertFalse(set.stream().anyMatch(entry -> entry.getKey().equals("PR-1-from/develop-master"))); }