Visitar URL original
Test the depth semantics of the impl scope and optional selectors by slachiewicz · Pull Request #2288 · apache/maven-resolver · GitHub
Skip to content

Test the depth semantics of the impl scope and optional selectors - #2288

Open
slachiewicz wants to merge 1 commit into
masterfrom
agent/scope-selector-tests
Open

slachiewicz wants to merge 1 commit into
masterfrom
agent/scope-selector-tests

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Fixes #784. The issue asked for tests of ScopeDependencySelector and OptionalDependencySelector in maven-resolver-util; the test classes that exist there only cover toString(), and both classes are now deprecated in favour of the same-named classes in org.eclipse.aether.internal.impl.scope, which had no tests at all. The new tests therefore cover the impl classes.

What they pin down is the depth model, which is the part the Javadoc states and nothing exercised directly: the session selector sits above the root, each deriveChildSelector moves one level down, fromRoot filters from the first level while fromDirect keeps direct dependencies of any scope (or optional), fromTo stops applying beyond the upper bound, and legacy shifts a level only when collection starts from an artifact rather than a dependency, which is the Resolver 1.x behaviour. For the optional selector the two session-data hooks are covered: IGNORED_KEYS exempts an artifact, UNSELECTED_KEYS collects the ids that were dropped. The equality tests check the "starting state" note in both classes: two selectors at the same depth with the same configuration are still unequal when they got there from different starting points.

No change to 1.9.x: the util classes there are the live ones and their tests are JUnit 4.

Verified: mvn -pl maven-resolver-impl -am test -Dtest=ScopeDependencySelectorTest,OptionalDependencySelectorTest on JDK 21 → 9 + 6 tests, 0 failures; spotless:apply left the files unchanged.

@slachiewicz
slachiewicz marked this pull request as ready for review November 7, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MRESOLVER-12] Addition of unit tests for DependencySelector implementations

1 participant