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

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


The following commit(s) were added to refs/heads/fix-build by this push:
     new 251945b  Add unit test for GpgSigner homeDir path handling
251945b is described below

commit 251945b9a6f2bea82f53676c56bb6cbd62faedf4
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Mon Jun 29 23:20:23 2026 +0200

    Add unit test for GpgSigner homeDir path handling
---
 .../apache/maven/plugins/gpg/GpgSignerTest.java    | 68 ++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/src/test/java/org/apache/maven/plugins/gpg/GpgSignerTest.java 
b/src/test/java/org/apache/maven/plugins/gpg/GpgSignerTest.java
new file mode 100644
index 0000000..8087b00
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugins/gpg/GpgSignerTest.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugins.gpg;
+
+import java.io.File;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Tests for {@link GpgSigner}.
+ */
+class GpgSignerTest {
+
+    @Test
+    void testGpgSignerInstantiation() {
+        GpgSigner signer = new GpgSigner("gpg");
+        assertNotNull(signer);
+        assertEquals("gpg", signer.signerName());
+    }
+
+    @Test
+    void testGpgSignerInstantiationWithExplicitExecutable() {
+        GpgSigner signer = new GpgSigner("/usr/bin/gpg");
+        assertNotNull(signer);
+        assertEquals("gpg", signer.signerName());
+    }
+
+    @Test
+    void testHomeDirPathHandling() {
+        GpgSigner signer = new GpgSigner("gpg");
+        File homeDir = new File("/some/path/to/gnupg");
+        signer.setHomeDirectory(homeDir);
+        assertNotNull(homeDir);
+        assertEquals("/some/path/to/gnupg", homeDir.getAbsolutePath());
+    }
+
+    @Test
+    void testWindowsStylePath() {
+        GpgSigner signer = new GpgSigner("gpg");
+        File homeDir = new File("D:\\a\\project\\target\\test-classes\\gnupg");
+        signer.setHomeDirectory(homeDir);
+        assertNotNull(homeDir);
+        String absolutePath = homeDir.getAbsolutePath();
+        assertTrue(
+                absolutePath.contains("test-classes") && 
absolutePath.contains("gnupg"),
+                "Path should contain expected segments: " + absolutePath);
+    }
+}

Reply via email to