@Test public void shouldPerformFiltering() throws ArtifactFilterException { final Set<Artifact> given = new HashSet<>(); given.add(included1); given.add(excluded); given.add(included2); assertThat(filter.filter(given)).containsOnly(included1, included2); }
@Override public Set<Artifact> filter(final Set<Artifact> artifacts) throws ArtifactFilterException { final Set<Artifact> included = new HashSet<>(); for (final Artifact given : artifacts) { if (isArtifactIncluded(given)) { included.add(given); } } return included; }
ExcludeFilter implements ArtifactsFilter { @Override public Set<Artifact> filter(final Set<Artifact> artifacts) throws ArtifactFilterException { final Set<Artifact> included = new HashSet<>(); for (final Artifact given : artifacts) { if (isArtifactIncluded(given)) { included.add(given); } } return included; } }
ExcludeFilter implements ArtifactsFilter { @Override public Set<Artifact> filter(final Set<Artifact> artifacts) throws ArtifactFilterException { final Set<Artifact> included = new HashSet<>(); for (final Artifact given : artifacts) { if (isArtifactIncluded(given)) { included.add(given); } } return included; } ExcludeFilter(final String excludedGroupId, final String excludedArtifactId); }
ExcludeFilter implements ArtifactsFilter { @Override public Set<Artifact> filter(final Set<Artifact> artifacts) throws ArtifactFilterException { final Set<Artifact> included = new HashSet<>(); for (final Artifact given : artifacts) { if (isArtifactIncluded(given)) { included.add(given); } } return included; } ExcludeFilter(final String excludedGroupId, final String excludedArtifactId); @Override Set<Artifact> filter(final Set<Artifact> artifacts); @Override boolean isArtifactIncluded(final Artifact artifact); }
ExcludeFilter implements ArtifactsFilter { @Override public Set<Artifact> filter(final Set<Artifact> artifacts) throws ArtifactFilterException { final Set<Artifact> included = new HashSet<>(); for (final Artifact given : artifacts) { if (isArtifactIncluded(given)) { included.add(given); } } return included; } ExcludeFilter(final String excludedGroupId, final String excludedArtifactId); @Override Set<Artifact> filter(final Set<Artifact> artifacts); @Override boolean isArtifactIncluded(final Artifact artifact);  }