dmlloyd commented on code in PR #1014:
URL: https://github.com/apache/maven/pull/1014#discussion_r1117940782


##########
maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java:
##########
@@ -209,6 +208,26 @@ public void testVersionComparing() {
         checkVersionsOrder("2.0.1-xyz", "2.0.1-123");
     }
 
+    @Test
+    public void testLeadingZeroes() {
+        checkVersionsOrder("0.7", "2");
+        checkVersionsOrder("0.2", "1.0.7");
+    }
+
+    @Test
+    public void testGetCanonical() {
+        // MNG-7700
+        newComparable("0.x");
+        newComparable("0-x");
+        newComparable("0.rc");
+        newComparable("0-1");
+
+        ComparableVersion version = new ComparableVersion("0.x");
+        assertEquals("x", version.getCanonical());

Review Comment:
   This is not really a useful test. You're just testing that the output is 
what the output is. If you do this instead, you'll see that the "canonical" 
version is not really a canonical version at all:
   
   ```java
   ComparableVersion version = new ComparableVersion("0.x");
   ComparableVersion canonical = new ComparableVersion(version.getCanonical());
   assertEquals(canonical, version); // actually see if the *versions* are equal
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to