[MSHARED-562] changed MavenUtils.compareToVersion(version) order: compare current with version (and not the opposite)
git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@1750208 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/maven/shared/project/runtime/MavenUtils.java b/src/main/java/org/apache/maven/shared/project/runtime/MavenUtils.java
index 3e0f93a..eed9e58 100644
--- a/src/main/java/org/apache/maven/shared/project/runtime/MavenUtils.java
+++ b/src/main/java/org/apache/maven/shared/project/runtime/MavenUtils.java
@@ -64,8 +64,9 @@
}
/**
- * Returns a positive value if the version parameter is bigger compared to the runtime Maven version
- * Returns a negative value if the version parameter is less compared to the runtime Maven version
+ * Compares the runtime Maven version to the version parameter.
+ * Returns a positive value if the runtime Maven version is bigger than the version parameter.
+ * Returns a negative value if the runtime Maven version is less than the version parameter.
* Returns 0 if they are the same.
*
* @param version the version to compare
@@ -73,6 +74,6 @@
*/
public static int compareToVersion( String version )
{
- return new DefaultArtifactVersion( version ).compareTo( new DefaultArtifactVersion( getMavenVersion() ) );
+ return new DefaultArtifactVersion( getMavenVersion() ).compareTo( new DefaultArtifactVersion( version ) );
}
}
diff --git a/src/test/java/org/apache/maven/shared/project/runtime/MavenUtilsTest.java b/src/test/java/org/apache/maven/shared/project/runtime/MavenUtilsTest.java
index ab73561..7868a0a 100644
--- a/src/test/java/org/apache/maven/shared/project/runtime/MavenUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/project/runtime/MavenUtilsTest.java
@@ -29,8 +29,8 @@
@Test
public void testCompareToVersion()
{
- assertTrue( MavenUtils.compareToVersion( "101.0.0" ) > 0 );
+ assertTrue( MavenUtils.compareToVersion( "101.0.0" ) < 0 );
assertTrue( MavenUtils.compareToVersion( MavenUtils.getMavenVersion() ) == 0 );
- assertTrue( MavenUtils.compareToVersion( "0.0.1" ) < 0 );
+ assertTrue( MavenUtils.compareToVersion( "0.0.1" ) > 0 );
}
}