### Question:
ProjectPomModel implements PomModel { @Override public Collection<AFReleaseId> getDependencies() { return dependenciesByScope.values() .stream() .flatMap(Collection::stream) .collect(Collectors.toList()); } ProjectPomModel(final MavenSession mavenSession); @Override AFReleaseId getReleaseId(); @Override AFReleaseId getParentReleaseId(); @Override Collection<AFReleaseId> getDependencies(); @Override Collection<AFReleaseId> getDependencies(final DependencyFilter filter);  }### Answer:
@Test public void getDependencies() { final MavenSession mavenSession = mockMavenSession(false); mockDependencies(mavenSession.getCurrentProject()); final ProjectPomModel pomModel = new ProjectPomModel(mavenSession); final Collection<AFReleaseId> dependencies = pomModel.getDependencies(); assertThat(dependencies).isNotNull().hasSize(2); assertThat(dependencies).areExactly(1, new Condition<>( releaseId -> releaseId instanceof AFReleaseIdImpl && DEPENDENCY_GROUP_ID.equals(releaseId.getGroupId()) && DEPENDENCY_ARTIFACT_ID1.equals(releaseId.getArtifactId()) && DEPENDENCY_VERSION.equals(releaseId.getVersion()) && DEPENDENCY_PACKAGING.equals(((AFReleaseIdImpl) releaseId).getType()), "Is dependency 1")); assertThat(dependencies).areExactly(1, new Condition<>( releaseId -> releaseId instanceof AFReleaseIdImpl && DEPENDENCY_GROUP_ID.equals(releaseId.getGroupId()) && DEPENDENCY_ARTIFACT_ID2.equals(releaseId.getArtifactId()) && DEPENDENCY_VERSION.equals(releaseId.getVersion()) && DEPENDENCY_PACKAGING.equals(((AFReleaseIdImpl) releaseId).getType()), "Is dependency 2")); }
@Test public void getDependenciesEmpty() { final MavenSession mavenSession = mockMavenSession(false); final ProjectPomModel pomModel = new ProjectPomModel(mavenSession); final Collection<AFReleaseId> dependencies = pomModel.getDependencies(); assertThat(dependencies).isNotNull().isEmpty(); }
@Test public void getDependenciesWithFilter() { final MavenSession mavenSession = mockMavenSession(false); mockDependencies(mavenSession.getCurrentProject()); final ProjectPomModel pomModel = new ProjectPomModel(mavenSession); final Collection<AFReleaseId> dependencies = pomModel.getDependencies( (releaseId, scope) -> DEPENDENCY_SCOPE1.equals(scope)); assertThat(dependencies).isNotNull().hasSize(1); assertThat(dependencies).areExactly(1, new Condition<>( releaseId -> releaseId instanceof AFReleaseIdImpl && DEPENDENCY_GROUP_ID.equals(releaseId.getGroupId()) && DEPENDENCY_ARTIFACT_ID1.equals(releaseId.getArtifactId()) && DEPENDENCY_VERSION.equals(releaseId.getVersion()) && DEPENDENCY_PACKAGING.equals(((AFReleaseIdImpl) releaseId).getType()), "Is dependency 1")); }