maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [maven-gpg-plugin] Tibor17 commented on a change in pull request #8: [MGPG-78] gpg version parsing failure on Windows
Date Thu, 23 Apr 2020 19:29:45 GMT

Tibor17 commented on a change in pull request #8:
URL: https://github.com/apache/maven-gpg-plugin/pull/8#discussion_r414065952



##########
File path: src/test/java/org/apache/maven/plugins/gpg/GpgVersionTest.java
##########
@@ -19,19 +19,30 @@
  * under the License.
  */
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import org.apache.maven.plugins.gpg.GpgVersion;
 import org.junit.Test;
 
+/**
+ * Tests for {@link GpgVersion}.
+ */
 public class GpgVersionTest
 {
     @Test
     public void test()
     {
-        assertTrue( GpgVersion.parse( "gpg (GnuPG) 2.2.1" ).isAtLeast( GpgVersion.parse(
"gpg (GnuPG) 2.2.1" ) ) );
-        assertTrue( GpgVersion.parse( "gpg (GnuPG) 2.2.1" ).isAtLeast( GpgVersion.parse(
"2.1" ) ) );
-        assertTrue( GpgVersion.parse( "gpg (GnuPG/MacGPG2) 2.2.10" ).isAtLeast( GpgVersion.parse(
"2.2.10" ) ) );
+        assertEquals( GpgVersion.parse( "gpg (GnuPG) 2.2.1" )
+                .compareTo( GpgVersion.parse( "gpg (GnuPG) 2.2.1" ) ), 0 );
+
+        assertTrue( GpgVersion.parse( "gpg (GnuPG) 2.2.1" )
+                .isAtLeast( GpgVersion.parse( "2.1" ) ) );
+
+        assertEquals( GpgVersion.parse( "gpg (GnuPG/MacGPG2) 2.2.10" )
+                .compareTo( GpgVersion.parse( "2.2.10" ) ), 0 );
+
+        assertEquals( GpgVersion.parse( "gpg (GnuPG) 2.0.26 (Gpg4win 2.2.3)" )

Review comment:
       @rfscholte From the expected business behavior you are right.
   
   >> Equals compares the raw value
   
   The `equals` and `hashcode` is not implemented and it is not the matter of my fix.
   
   I would use `before` and `atLeast` sine this also makes business value for me.
   What is missing in the master is the negative test because here we assert that `atLeast`
returns `true` but it does not necessarily means that `before` would return `false` in buggy
implementation.




----------------------------------------------------------------
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.

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



Mime
View raw message