From 2c0c1413287afa91a192fd0595d5afee09b8ce07 Mon Sep 17 00:00:00 2001 From: Andrzej Jarmoniuk Date: Fri, 19 May 2023 17:08:00 +0200 Subject: [PATCH] Resolves #921: Refactoring segments; work in progress --- .../versions/api/AbstractVersionDetails.java | 12 ++-- .../mojo/versions/api/VersionDetails.java | 8 ++- .../ordering/BoundArtifactVersion.java | 50 +++++++------ .../ordering/BoundArtifactVersionTest.java | 60 ++++++++++++---- .../DisplayDependencyUpdatesMojo.java | 34 ++------- .../DisplayDependencyUpdatesMojoTest.java | 70 ------------------- 6 files changed, 90 insertions(+), 144 deletions(-) diff --git a/versions-common/src/main/java/org/codehaus/mojo/versions/api/AbstractVersionDetails.java b/versions-common/src/main/java/org/codehaus/mojo/versions/api/AbstractVersionDetails.java index 02f7bae7d..e9e840599 100644 --- a/versions-common/src/main/java/org/codehaus/mojo/versions/api/AbstractVersionDetails.java +++ b/versions-common/src/main/java/org/codehaus/mojo/versions/api/AbstractVersionDetails.java @@ -69,7 +69,7 @@ public abstract class AbstractVersionDetails implements VersionDetails { protected AbstractVersionDetails() {} @Override - public Restriction restrictionFor(Optional scope) throws InvalidSegmentException { + public Restriction restrictionForUnchangedSegment(Optional unchangedSegment) throws InvalidSegmentException { // one range spec can have multiple restrictions, and multiple 'lower bound', we want the highest one. // [1.0,2.0),[3.0,4.0) -> 3.0 ArtifactVersion highestLowerBound = currentVersion; @@ -87,13 +87,13 @@ public Restriction restrictionFor(Optional scope) throws InvalidSegment } final ArtifactVersion currentVersion = highestLowerBound; - ArtifactVersion nextVersion = scope.filter(s -> s.isMajorTo(SUBINCREMENTAL)) + ArtifactVersion nextVersion = unchangedSegment.filter(s -> s.isMajorTo(SUBINCREMENTAL)) .map(s -> (ArtifactVersion) new BoundArtifactVersion(currentVersion, Segment.of(s.value() + 1))) .orElse(currentVersion); return new Restriction( nextVersion, false, - scope.filter(MAJOR::isMajorTo) + unchangedSegment.filter(MAJOR::isMajorTo) .map(s -> (ArtifactVersion) new BoundArtifactVersion(currentVersion, s)) .orElse(null), false); @@ -267,7 +267,7 @@ public final ArtifactVersion[] getVersions( public final ArtifactVersion getNewestUpdate( ArtifactVersion currentVersion, Optional updateScope, boolean includeSnapshots) { try { - return getNewestVersion(restrictionFor(updateScope), includeSnapshots); + return getNewestVersion(restrictionForUnchangedSegment(updateScope), includeSnapshots); } catch (InvalidSegmentException e) { return null; } @@ -277,7 +277,7 @@ public final ArtifactVersion getNewestUpdate( public final ArtifactVersion[] getAllUpdates( ArtifactVersion currentVersion, Optional updateScope, boolean includeSnapshots) { try { - return getVersions(restrictionFor(updateScope), includeSnapshots); + return getVersions(restrictionForUnchangedSegment(updateScope), includeSnapshots); } catch (InvalidSegmentException e) { return null; } @@ -435,7 +435,7 @@ public final ArtifactVersion[] getReportUpdates(Optional updateScope, b private Stream getArtifactVersionStream(Optional updateScope, boolean includeSnapshots) { if (isCurrentVersionDefined()) { try { - Restriction restriction = restrictionFor(updateScope); + Restriction restriction = restrictionForUnchangedSegment(updateScope); return Arrays.stream(getVersions(includeSnapshots)) .filter(candidate -> isVersionInRestriction(restriction, candidate)); diff --git a/versions-common/src/main/java/org/codehaus/mojo/versions/api/VersionDetails.java b/versions-common/src/main/java/org/codehaus/mojo/versions/api/VersionDetails.java index 79b369bf6..727326ead 100644 --- a/versions-common/src/main/java/org/codehaus/mojo/versions/api/VersionDetails.java +++ b/versions-common/src/main/java/org/codehaus/mojo/versions/api/VersionDetails.java @@ -331,7 +331,8 @@ ArtifactVersion[] getAllUpdates(Optional updateScope, boolean includeSn /** *

Returns a {@linkplain Restriction} object for computing version upgrades - * with the given segment allowing updates, with all more major segments locked in place.

+ * with the given segment being the least major segment to be left unchanged, + * with all more major segments locked in place.

*

The resulting restriction could be thought of as one * retaining the versions on positions up to the held position, * the position right after the position held in place will be incremented by one, @@ -340,12 +341,13 @@ ArtifactVersion[] getAllUpdates(Optional updateScope, boolean includeSn *

This will allow matching the required versions while not matching versions which are considered * inferior than the zeroth version, i.e. versions with a qualifier.

* - * @param scope most major segment where updates are allowed Optional.empty() for no restriction + * @param unchangedSegment least major segment where updates are allowed; {@code Optional.empty()} + * for no restriction * @return {@linkplain Restriction} object based on the arguments * @throws InvalidSegmentException if the requested segment is outside the bounds (less than 1 or greater than * the segment count) */ - Restriction restrictionFor(Optional scope) throws InvalidSegmentException; + Restriction restrictionForUnchangedSegment(Optional unchangedSegment) throws InvalidSegmentException; /** * Returns the {@link Restriction} objects for a segemnt scope which is to be ignored. diff --git a/versions-common/src/main/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersion.java b/versions-common/src/main/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersion.java index 5612d05bf..fe770853a 100644 --- a/versions-common/src/main/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersion.java +++ b/versions-common/src/main/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersion.java @@ -1,8 +1,5 @@ package org.codehaus.mojo.versions.ordering; -import java.util.ArrayList; -import java.util.List; - import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.maven.artifact.versioning.ArtifactVersion; @@ -10,15 +7,20 @@ import org.codehaus.mojo.versions.utils.DefaultArtifactVersionCache; import org.codehaus.plexus.util.StringUtils; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + /** - *

Represents an immutable artifact version with all segments major to the given segment + *

Represents an immutable upper bound artifact version + * where all segments major or equal to the given segment * held in place. It can be thought of as an artifact having +∞ as its upper bound - * on all segments minor to the held segment.

+ * on all segments minor or equal to the held segment.

*

For example:

*

A {@link BoundArtifactVersion} of {@code [1.2.3-2, INCREMENTAL]} can be seen as {@code 1.2.+∞} * and will be greater than all versions matching the {@code 1.2.*} pattern.

*

A {@link BoundArtifactVersion} of {@code [1.2.3-2, SUBINCREMENTAL]} will be greater - * * than all versions matching the {@code 1.2.3-2.*} pattern.

+ * * than all versions matching the {@code 1.2.3.*} pattern.

*

When compared to another artifact versions, this results with the other object * with the segment versions up to the held segment being equal, * always comparing lower than this object.

@@ -27,26 +29,33 @@ */ public class BoundArtifactVersion implements ArtifactVersion { /** - * Most major segment that can change, i.e. not held in place. - * All segments that are more major than this one are held in place. + * Least major segment that may not change + * All segments that are more major than this one are also held in place. + * If equal to {@code null}, no restrictions are in place, meaning that all version + * segments can change freely. */ - private final Segment segment; + private final Segment unchangedSegment; private final ArtifactVersion comparable; /** * Constructs the instance given the version in a text format. * @param artifactVersion version in a text format - * @param segment most major segment that can change, i.e. not held in place + * @param unchangedSegment most major segment that may not change, may be {@code null} meaning no restrictions */ - public BoundArtifactVersion(String artifactVersion, Segment segment) { - this.segment = segment; + public BoundArtifactVersion(String artifactVersion, Segment unchangedSegment) { + this.unchangedSegment = unchangedSegment; + comparable = createComparable(artifactVersion, unchangedSegment); + } + + static ArtifactVersion createComparable(String artifactVersion, Segment unchangedSegment) { + final ArtifactVersion comparable; StringBuilder versionBuilder = new StringBuilder(); String[] segments = tokens(artifactVersion); for (int segNr = 0; segNr <= segments.length || segNr <= Segment.SUBINCREMENTAL.value(); segNr++, versionBuilder.append(".")) { - if (segNr < segment.value()) { + if (segNr <= Optional.ofNullable(unchangedSegment).map(Segment::value).orElse(-1)) { versionBuilder.append(segNr < segments.length ? integerItemOrZero(segments[segNr]) : "0"); } else { versionBuilder.append(Integer.MAX_VALUE); @@ -54,15 +63,16 @@ public BoundArtifactVersion(String artifactVersion, Segment segment) { } versionBuilder.append(Integer.MAX_VALUE); comparable = DefaultArtifactVersionCache.of(versionBuilder.toString()); + return comparable; } /** * Constructs the instance given a {@link ArtifactVersion instance} * @param artifactVersion artifact version containing the segment version values - * @param segment most major segment that can change, i.e. not held in place + * @param unchangedSegment least major segment that may not change */ - public BoundArtifactVersion(ArtifactVersion artifactVersion, Segment segment) { - this(artifactVersion.toString(), segment); + public BoundArtifactVersion(ArtifactVersion artifactVersion, Segment unchangedSegment) { + this(artifactVersion.toString(), unchangedSegment); } /** @@ -108,8 +118,8 @@ private static String integerItemOrZero(String item) { * All segments that are more major than this one are held in place. * @return segment that can change */ - public Segment getSegment() { - return segment; + public Segment getUnchangedSegment() { + return unchangedSegment; } @Override @@ -135,7 +145,7 @@ public boolean equals(Object o) { return new EqualsBuilder() .appendSuper(super.equals(o)) - .append(getSegment(), that.getSegment()) + .append(getUnchangedSegment(), that.getUnchangedSegment()) .append(comparable, that.comparable) .isEquals(); } @@ -144,7 +154,7 @@ public boolean equals(Object o) { public int hashCode() { return new HashCodeBuilder(17, 37) .appendSuper(super.hashCode()) - .append(getSegment()) + .append(getUnchangedSegment()) .append(comparable) .toHashCode(); } diff --git a/versions-common/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java b/versions-common/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java index 18bad5911..00e2f650e 100644 --- a/versions-common/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java +++ b/versions-common/src/test/java/org/codehaus/mojo/versions/ordering/BoundArtifactVersionTest.java @@ -27,65 +27,95 @@ import static org.codehaus.mojo.versions.api.Segment.MINOR; import static org.codehaus.mojo.versions.api.Segment.SUBINCREMENTAL; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.Matchers.lessThan; +import static org.hamcrest.Matchers.*; /** * Unit tests for {@link BoundArtifactVersion} */ public class BoundArtifactVersionTest { @Test - public void testMajorUpperBoundGreaterThanNextMajor() { - BoundArtifactVersion bound = new BoundArtifactVersion("1.2.3", MAJOR); + public void testCreateComparableForNoRestrictions() { + ArtifactVersion comparable = BoundArtifactVersion.createComparable("1.2.3", null); + assertThat(comparable.toString(), matchesPattern("^\\Q2147483647.2147483647.2147483647\\E.*")); + } + + @Test + public void testCreateComparableForMajor() { + ArtifactVersion comparable = BoundArtifactVersion.createComparable("1.2.3", MAJOR); + assertThat(comparable.toString(), matchesPattern("^\\Q1.2147483647.2147483647\\E.*")); + } + + @Test + public void testCreateComparableForMinor() { + ArtifactVersion comparable = BoundArtifactVersion.createComparable("1.2.3", MINOR); + assertThat(comparable.toString(), matchesPattern("^\\Q1.2.2147483647\\E.*")); + } + + @Test + public void testCreateComparableForIncremental() { + ArtifactVersion comparable = BoundArtifactVersion.createComparable("1.2.3", INCREMENTAL); + assertThat(comparable.toString(), matchesPattern("^\\Q1.2.3\\E.*")); + } + + @Test + public void testCreateComparableForSubIncremental() { + ArtifactVersion comparable = BoundArtifactVersion.createComparable("1.2.3-4", SUBINCREMENTAL); + assertThat(comparable.toString(), matchesPattern("^\\Q1.2.3.4\\E.*")); + } + + + @Test + public void testNullLockedGreaterThanNextMajor() { + BoundArtifactVersion bound = new BoundArtifactVersion("1.2.3", null); ArtifactVersion artifactVersion = DefaultArtifactVersionCache.of("2.0.0"); assertThat(bound.compareTo(artifactVersion), greaterThan(0)); } @Test - public void testSubIncrementalUpperBoundGreaterThanNextSubIncremental() { - BoundArtifactVersion bound = new BoundArtifactVersion("1.2.3-2", SUBINCREMENTAL); + public void testIncrementalLockedGreaterThanNextSubIncremental() { + BoundArtifactVersion bound = new BoundArtifactVersion("1.2.3-2", INCREMENTAL); ArtifactVersion artifactVersion = DefaultArtifactVersionCache.of("1.2.3-3"); assertThat(bound.compareTo(artifactVersion), greaterThan(0)); } @Test public void testVersionShorterThanSegment() { - BoundArtifactVersion bound = new BoundArtifactVersion("1.1", INCREMENTAL); + BoundArtifactVersion bound = new BoundArtifactVersion("1.1", MINOR); ArtifactVersion artifactVersion = DefaultArtifactVersionCache.of("1.1.3"); assertThat(bound.compareTo(artifactVersion), greaterThan(0)); } @Test public void testVersionBoundArtifactVersionShorterThanConcreteVersionAndSegment() { - BoundArtifactVersion bound = new BoundArtifactVersion("1.1", SUBINCREMENTAL); + BoundArtifactVersion bound = new BoundArtifactVersion("1.1", INCREMENTAL); ArtifactVersion artifactVersion = DefaultArtifactVersionCache.of("1.1.3"); assertThat(bound.compareTo(artifactVersion), lessThan(0)); } @Test - public void testVersionSubIncrementalBoundGreaterThanSubIncremental() { - BoundArtifactVersion bound = new BoundArtifactVersion("1.1", SUBINCREMENTAL); + public void testVersionHeldIncrementalBoundGreaterThanSubIncremental() { + BoundArtifactVersion bound = new BoundArtifactVersion("1.1", INCREMENTAL); ArtifactVersion artifactVersion = DefaultArtifactVersionCache.of("1.1.0-2"); assertThat(bound.compareTo(artifactVersion), greaterThan(0)); } @Test - public void testVersionSubIncrementalBoundGreaterThanIncremental() { - BoundArtifactVersion bound = new BoundArtifactVersion("1.1", INCREMENTAL); + public void testVersionHeldMinorBoundGreaterThanIncremental() { + BoundArtifactVersion bound = new BoundArtifactVersion("1.1", MINOR); ArtifactVersion artifactVersion = DefaultArtifactVersionCache.of("1.1.3"); assertThat(bound.compareTo(artifactVersion), greaterThan(0)); } @Test - public void testVersionSubIncrementalBoundGreaterThanMinor() { - BoundArtifactVersion bound = new BoundArtifactVersion("1.1", MINOR); + public void testVersionHeldMajorBoundGreaterThanMinor() { + BoundArtifactVersion bound = new BoundArtifactVersion("1.1", MAJOR); ArtifactVersion artifactVersion = DefaultArtifactVersionCache.of("1.3"); assertThat(bound.compareTo(artifactVersion), greaterThan(0)); } @Test public void testSnapshotWithSubIncremental() { - BoundArtifactVersion bound = new BoundArtifactVersion("1.0.0-SNAPSHOT", MINOR); + BoundArtifactVersion bound = new BoundArtifactVersion("1.0.0-SNAPSHOT", MAJOR); ArtifactVersion artifactVersion = DefaultArtifactVersionCache.of("1.0.0"); assertThat(bound.compareTo(artifactVersion), greaterThan(0)); } diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojo.java index c4154f86f..ace8701a5 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojo.java @@ -206,9 +206,6 @@ public class DisplayDependencyUpdatesMojo extends AbstractVersionsDisplayMojo { /** * Whether to allow the major version number to be changed. * - *

Note: {@code false} also implies {@linkplain #allowAnyUpdates} - * to be {@code false}

- * * @since 2.5 */ @Parameter(property = "allowMajorUpdates", defaultValue = "true") @@ -217,8 +214,8 @@ public class DisplayDependencyUpdatesMojo extends AbstractVersionsDisplayMojo { /** *

Whether to allow the minor version number to be changed.

* - *

Note: {@code false} also implies {@linkplain #allowAnyUpdates} - * and {@linkplain #allowMajorUpdates} to be {@code false}

+ *

Note: {@code false} also implies {@linkplain #allowMajorUpdates} + * to be {@code false}

* * @since 2.5 */ @@ -228,32 +225,14 @@ public class DisplayDependencyUpdatesMojo extends AbstractVersionsDisplayMojo { /** *

Whether to allow the incremental version number to be changed.

* - *

Note: {@code false} also implies {@linkplain #allowAnyUpdates}, - * {@linkplain #allowMajorUpdates}, and {@linkplain #allowMinorUpdates} - * to be {@code false}

+ *

Note: {@code false} also implies {@linkplain #allowMajorUpdates} + * and {@linkplain #allowMinorUpdates} to be {@code false}

* * @since 2.5 */ @Parameter(property = "allowIncrementalUpdates", defaultValue = "true") private boolean allowIncrementalUpdates = true; - /** - *

Ignored -- largely replaced by {@linkplain #allowMajorUpdates}, - * {@linkplain #allowMinorUpdates} and {@linkplain #allowIncrementalUpdates}, - * which are equal to {@code true} by default.

- * - *

Please note: Prior to version 2.16.0, leaving this parameter at its default - * value ({@code true}) would mean that the plugin would ignore - * {@linkplain #allowMajorUpdates}, {@linkplain #allowMinorUpdates}, and {@linkplain #allowIncrementalUpdates}, - * which confused many users.

- * - * @since 2.5 - * @deprecated This will be removed with version 3.0.0 - */ - @Deprecated - @Parameter(property = "allowAnyUpdates", defaultValue = "true") - private boolean allowAnyUpdates = true; - /** * Whether to show additional information such as dependencies that do not need updating. Defaults to false. * @@ -484,11 +463,6 @@ protected void validateInput() throws MojoExecutionException { validateGAVList(pluginDependencyExcludes, 3, "pluginDependencyExcludes"); validateGAVList(pluginManagementDependencyIncludes, 3, "pluginManagementDependencyIncludes"); validateGAVList(pluginManagementDependencyExcludes, 3, "pluginManagementDependencyExcludes"); - if (getLog() != null - && allowAnyUpdates - && !(allowMajorUpdates && allowMinorUpdates && allowIncrementalUpdates)) { - getLog().warn("Assuming allowAnyUpdates false because one or more other \"allow\" switches is false."); - } } /** diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojoTest.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojoTest.java index c8367d0f5..8ae18d77d 100644 --- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojoTest.java +++ b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojoTest.java @@ -145,7 +145,6 @@ public void testVersionsWithQualifiersNotConsideredAsMinorUpdates() throws Excep null) { { setProject(createProject()); - setVariableValueToObject(this, "allowAnyUpdates", false); setVariableValueToObject(this, "allowMajorUpdates", false); setVariableValueToObject(this, "processDependencies", true); setVariableValueToObject(this, "dependencyIncludes", singletonList(WildcardMatcher.WILDCARD)); @@ -181,7 +180,6 @@ public void testAllowMajorUpdatesFalse() throws Exception { null) { { setProject(createProject()); - setVariableValueToObject(this, "allowAnyUpdates", false); setVariableValueToObject(this, "allowMajorUpdates", false); setVariableValueToObject(this, "processDependencies", true); setVariableValueToObject(this, "dependencyIncludes", singletonList(WildcardMatcher.WILDCARD)); @@ -214,7 +212,6 @@ public void testAllowMinorUpdatesFalse() throws Exception { null) { { setProject(createProject()); - setVariableValueToObject(this, "allowAnyUpdates", false); setVariableValueToObject(this, "allowMinorUpdates", false); setVariableValueToObject(this, "processDependencies", true); setVariableValueToObject(this, "dependencyIncludes", singletonList(WildcardMatcher.WILDCARD)); @@ -248,7 +245,6 @@ public void testAllowIncrementalUpdatesFalse() throws Exception { null) { { setProject(createProject()); - setVariableValueToObject(this, "allowAnyUpdates", false); setVariableValueToObject(this, "allowIncrementalUpdates", false); setVariableValueToObject(this, "processDependencies", true); setVariableValueToObject(this, "dependencyIncludes", singletonList(WildcardMatcher.WILDCARD)); @@ -285,7 +281,6 @@ public void testVersionsWithQualifiersNotConsideredAsIncrementalUpdates() throws null) { { setProject(createProject()); - setVariableValueToObject(this, "allowAnyUpdates", false); setVariableValueToObject(this, "allowMinorUpdates", false); setVariableValueToObject(this, "processDependencies", true); setVariableValueToObject(this, "dependencyIncludes", singletonList(WildcardMatcher.WILDCARD)); @@ -396,69 +391,4 @@ public void testAllowSnapshots() throws Exception { assertThat(output, containsString("1.0.1-SNAPSHOT")); } } - - /** - * With {@code allowMajorUpdates}, {@code allowMinorUpdates}, or {@code allowIncrementalUpdates} all equal - * {@code true}, {@code allowAnyUpdates} should be respected. - */ - @Test - public void testAllowAnyUpdatesTrue() throws Exception { - try (CloseableTempFile tempFile = new CloseableTempFile("display-dependency-updates")) { - new DisplayDependencyUpdatesMojo( - mockRepositorySystem(), - mockAetherRepositorySystem(new HashMap() { - { - put("default-dependency", new String[] {"2.0.0", "1.0.0"}); - } - }), - null, - null) { - { - setProject(createProject()); - setVariableValueToObject(this, "processDependencies", true); - setVariableValueToObject(this, "dependencyIncludes", singletonList(WildcardMatcher.WILDCARD)); - setVariableValueToObject(this, "dependencyExcludes", emptyList()); - this.outputFile = tempFile.getPath().toFile(); - setPluginContext(new HashMap<>()); - session = mockMavenSession(); - } - }.execute(); - - String output = String.join("", Files.readAllLines(tempFile.getPath())); - assertThat(output, containsString("2.0.0")); - } - } - - /** - * Setting {@code allowMajorUpdates}, {@code allowMinorUpdates}, or {@code allowIncrementalUpdates} to {@code false} - * should also set {@code allowAnyUpdates} to {@code false} - */ - @Test - public void testAllowAnyUpdatesFalseIfOtherAreSet() throws Exception { - try (CloseableTempFile tempFile = new CloseableTempFile("display-dependency-updates")) { - new DisplayDependencyUpdatesMojo( - mockRepositorySystem(), - mockAetherRepositorySystem(new HashMap() { - { - put("default-dependency", new String[] {"2.0.0", "1.0.0"}); - } - }), - null, - null) { - { - setProject(createProject()); - setVariableValueToObject(this, "processDependencies", true); - setVariableValueToObject(this, "dependencyIncludes", singletonList(WildcardMatcher.WILDCARD)); - setVariableValueToObject(this, "dependencyExcludes", emptyList()); - this.outputFile = tempFile.getPath().toFile(); - setVariableValueToObject(this, "allowMajorUpdates", false); - setPluginContext(new HashMap<>()); - session = mockMavenSession(); - } - }.execute(); - - String output = String.join("", Files.readAllLines(tempFile.getPath())); - assertThat(output, not(containsString("2.0.0"))); - } - } }