You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2023/08/15 10:26:39 UTC

[maven-gpg-plugin] branch MGPG-101 updated (ea56cf7 -> 777347d)

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a change to branch MGPG-101
in repository https://gitbox.apache.org/repos/asf/maven-gpg-plugin.git


 discard ea56cf7  [MGPG-101] Switch to JUnit 5
     new 777347d  [MGPG-101] Switch to JUnit 5

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (ea56cf7)
            \
             N -- N -- N   refs/heads/MGPG-101 (777347d)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pgp-keys-map.list | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


[maven-gpg-plugin] 01/01: [MGPG-101] Switch to JUnit 5

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MGPG-101
in repository https://gitbox.apache.org/repos/asf/maven-gpg-plugin.git

commit 777347d201e00a2040656b8b0b6a214d6cb40ac2
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Tue Aug 15 12:04:56 2023 +0200

    [MGPG-101] Switch to JUnit 5
---
 pgp-keys-map.list                                  | 11 +++++++-
 pom.xml                                            | 29 ++++++++++++++++----
 .../maven/plugins/gpg/GpgVersionConsumerTest.java  | 13 +++++----
 .../apache/maven/plugins/gpg/GpgVersionTest.java   | 18 ++++++------
 .../maven/plugins/gpg/it/GpgSignArtifactIT.java    | 32 ++++++----------------
 .../plugins/gpg/it/GpgSignAttachedMojoIT.java      | 19 ++++++-------
 6 files changed, 67 insertions(+), 55 deletions(-)

diff --git a/pgp-keys-map.list b/pgp-keys-map.list
index 1e2ffe9..0ca8e16 100644
--- a/pgp-keys-map.list
+++ b/pgp-keys-map.list
@@ -16,7 +16,16 @@
 # under the License.
 
 commons-io:commons-io = 0xCD5464315F0B98C77E6E8ECD9DAADC1C9FCC82D0
-junit:junit = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
+org.apiguardian:apiguardian-api:1.1.2 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
+org.junit.jupiter:junit-jupiter-api:5.10.0 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
+org.junit.jupiter:junit-jupiter-engine:5.10.0 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
+org.junit.jupiter:junit-jupiter-params:5.10.0 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
+org.junit.jupiter:junit-jupiter:5.10.0 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
+org.junit.platform:junit-platform-commons:1.10.0 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
+org.junit.platform:junit-platform-engine:1.10.0 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
+org.opentest4j:opentest4j:1.3.0 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
+net.bytebuddy:byte-buddy:1.12.21 = 0xB4AC8CDC141AF0AE468D16921DA784CCB5C46DD5
+org.assertj:assertj-core:3.24.2 = 0xBE685132AFD2740D9095F9040CC0B712FEE75827
 org.apache.maven.resolver = 0x522CA055B326A636D833EF6A0551FD3684FCBBB7
 org.apache.maven.shared:maven-artifact-transfer = 0x6A814B1F869C2BBEAB7CB7271A2A1C94BDE89688
 org.apache.maven.shared:maven-common-artifact-filters = 0xB02137D875D833D9B23392ECAE5A7FB608A0221C
diff --git a/pom.xml b/pom.xml
index 312b409..8704289 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,10 +62,23 @@ under the License.
   <properties>
     <mavenVersion>3.2.5</mavenVersion>
     <javaVersion>8</javaVersion>
+    <surefire.version>3.1.2</surefire.version>
     <project.build.outputTimestamp>2023-05-03T01:33:44Z</project.build.outputTimestamp>
     <resource.delimiter>@</resource.delimiter>
   </properties>
 
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.junit</groupId>
+        <artifactId>junit-bom</artifactId>
+        <version>5.10.0</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
   <dependencies>
     <dependency>
       <groupId>org.apache.maven</groupId>
@@ -139,15 +152,19 @@ under the License.
     </dependency>
 
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.13.2</version>
+      <groupId>org.assertj</groupId>
+      <artifactId>assertj-core</artifactId>
+      <version>3.24.2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.hamcrest</groupId>
-      <artifactId>hamcrest-core</artifactId>
-      <version>2.2</version>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-params</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/src/test/java/org/apache/maven/plugins/gpg/GpgVersionConsumerTest.java b/src/test/java/org/apache/maven/plugins/gpg/GpgVersionConsumerTest.java
index fc71836..030110f 100644
--- a/src/test/java/org/apache/maven/plugins/gpg/GpgVersionConsumerTest.java
+++ b/src/test/java/org/apache/maven/plugins/gpg/GpgVersionConsumerTest.java
@@ -18,18 +18,19 @@
  */
 package org.apache.maven.plugins.gpg;
 
+import java.io.IOException;
+
 import org.apache.maven.plugins.gpg.GpgVersionParser.GpgVersionConsumer;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
-public class GpgVersionConsumerTest {
+class GpgVersionConsumerTest {
     @Test
-    public void test() throws Exception {
+    void test() throws IOException {
         GpgVersionConsumer consumer = new GpgVersionConsumer();
         consumer.consumeLine("gpg (GnuPG/MacGPG2) 2.2.10");
 
-        assertThat(consumer.getGpgVersion(), is(GpgVersion.parse("2.2.10")));
+        assertEquals(consumer.getGpgVersion(), GpgVersion.parse("2.2.10"));
     }
 }
diff --git a/src/test/java/org/apache/maven/plugins/gpg/GpgVersionTest.java b/src/test/java/org/apache/maven/plugins/gpg/GpgVersionTest.java
index 9cc31cd..8e4eb17 100644
--- a/src/test/java/org/apache/maven/plugins/gpg/GpgVersionTest.java
+++ b/src/test/java/org/apache/maven/plugins/gpg/GpgVersionTest.java
@@ -18,19 +18,19 @@
  */
 package org.apache.maven.plugins.gpg;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * Tests for {@link GpgVersion}.
  */
-public class GpgVersionTest {
+class GpgVersionTest {
     @Test
-    public void test() {
+    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")));
@@ -38,7 +38,7 @@ public class GpgVersionTest {
     }
 
     @Test
-    public void testOpposite() {
+    void testOpposite() {
         assertFalse(GpgVersion.parse("gpg (GnuPG) 2.2.1").isBefore(GpgVersion.parse("gpg (GnuPG) 2.2.1")));
         assertFalse(GpgVersion.parse("gpg (GnuPG) 2.2.1").isBefore(GpgVersion.parse("2.1")));
         assertFalse(GpgVersion.parse("gpg (GnuPG/MacGPG2) 2.2.10").isBefore(GpgVersion.parse("2.2.10")));
@@ -46,7 +46,7 @@ public class GpgVersionTest {
     }
 
     @Test
-    public void testEquality() {
+    void testEquality() {
         assertEquals(GpgVersion.parse("gpg (GnuPG) 2.2.1"), GpgVersion.parse("gpg (GnuPG) 2.2.1"));
         assertEquals(GpgVersion.parse("gpg (GnuPG) 2.2.1"), GpgVersion.parse("2.2.1"));
         assertEquals(GpgVersion.parse("gpg (GnuPG/MacGPG2) 2.2.10"), GpgVersion.parse("2.2.10"));
diff --git a/src/test/java/org/apache/maven/plugins/gpg/it/GpgSignArtifactIT.java b/src/test/java/org/apache/maven/plugins/gpg/it/GpgSignArtifactIT.java
index 8ea07dd..e5374e6 100644
--- a/src/test/java/org/apache/maven/plugins/gpg/it/GpgSignArtifactIT.java
+++ b/src/test/java/org/apache/maven/plugins/gpg/it/GpgSignArtifactIT.java
@@ -23,17 +23,11 @@ import java.util.Arrays;
 import java.util.Collection;
 
 import org.apache.maven.shared.invoker.InvocationRequest;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
-import static org.hamcrest.Matchers.equalTo;
-import static org.junit.runners.Parameterized.Parameter;
-import static org.junit.runners.Parameterized.Parameters;
+import static org.assertj.core.api.Assertions.assertThat;
 
-@RunWith(Parameterized.class)
 public class GpgSignArtifactIT {
     private final File mavenHome;
     private final File localRepository;
@@ -47,7 +41,6 @@ public class GpgSignArtifactIT {
         this.gpgHome = new File(System.getProperty("gpg.homedir"));
     }
 
-    @Parameters
     public static Collection<Object[]> data() {
         return Arrays.asList(new Object[][] {
             {
@@ -73,17 +66,10 @@ public class GpgSignArtifactIT {
         });
     }
 
-    @Parameter
-    public String pomPath;
-
-    @Parameter(1)
-    public String expectedFileLocation;
-
-    @Parameter(2)
-    public String[] expectedFiles;
-
-    @Test
-    public void testPlacementOfArtifactInOutputDirectory() throws Exception {
+    @MethodSource("data")
+    @ParameterizedTest
+    void testPlacementOfArtifactInOutputDirectory(String pomPath, String expectedFileLocation, String[] expectedFiles)
+            throws Exception {
         // given
         final File pomFile = InvokerTestUtils.getTestResource(pomPath);
         final InvocationRequest request = InvokerTestUtils.createRequest(pomFile, mavenUserSettings, gpgHome);
@@ -94,7 +80,7 @@ public class GpgSignArtifactIT {
         InvokerTestUtils.executeRequest(request, mavenHome, localRepository);
 
         // then
-        assertThat(expectedOutputDirectory.exists(), equalTo(true));
-        assertThat(expectedOutputDirectory.list(), arrayContainingInAnyOrder(expectedFiles));
+        assertThat(expectedOutputDirectory).exists();
+        assertThat(expectedOutputDirectory.list()).containsExactlyInAnyOrder(expectedFiles);
     }
 }
diff --git a/src/test/java/org/apache/maven/plugins/gpg/it/GpgSignAttachedMojoIT.java b/src/test/java/org/apache/maven/plugins/gpg/it/GpgSignAttachedMojoIT.java
index c6df9c7..3101b93 100644
--- a/src/test/java/org/apache/maven/plugins/gpg/it/GpgSignAttachedMojoIT.java
+++ b/src/test/java/org/apache/maven/plugins/gpg/it/GpgSignAttachedMojoIT.java
@@ -23,11 +23,9 @@ import java.io.File;
 import org.apache.maven.shared.invoker.InvocationRequest;
 import org.apache.maven.shared.invoker.InvocationResult;
 import org.codehaus.plexus.util.FileUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.not;
+import static org.assertj.core.api.Assertions.assertThat;
 
 public class GpgSignAttachedMojoIT {
 
@@ -44,7 +42,7 @@ public class GpgSignAttachedMojoIT {
     }
 
     @Test
-    public void testInteractiveWithoutPassphrase() throws Exception {
+    void testInteractiveWithoutPassphrase() throws Exception {
         // given
         final File pomFile =
                 InvokerTestUtils.getTestResource("/it/sign-release-without-passphrase-interactive/pom.xml");
@@ -60,10 +58,11 @@ public class GpgSignAttachedMojoIT {
         final String buildLogContent = FileUtils.fileRead(result.getBuildLog());
 
         // then
-        assertThat("Maven execution must fail", invocationResult.getExitCode(), not(0));
-        assertThat(
-                "Maven execution failed because no pinentry program is available",
-                buildLogContent,
-                containsString("[GNUPG:] FAILURE sign 67108949"));
+        assertThat(invocationResult.getExitCode())
+                .as("Maven execution must fail")
+                .isNotEqualTo(0);
+        assertThat(buildLogContent)
+                .as("Maven execution failed because no pinentry program is available")
+                .contains("[GNUPG:] FAILURE sign 67108949");
     }
 }