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 2026/09/19 22:25:28 UTC

(maven-shade-plugin) branch master updated: Drop Hamcrest from tests

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

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


The following commit(s) were added to refs/heads/master by this push:
     new f7802476 Drop Hamcrest from tests
f7802476 is described below

commit f78024760541d8a1aa6adaf7e574ae63c5773077
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sat Sep 19 23:52:16 2026 +0200

    Drop Hamcrest from tests
---
 pom.xml                                            | 10 -----
 .../maven/plugins/shade/DefaultShaderTest.java     | 52 ++++++++++++----------
 2 files changed, 29 insertions(+), 33 deletions(-)

diff --git a/pom.xml b/pom.xml
index b1eb31b1..71b378d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -94,11 +94,6 @@
         <artifactId>junit</artifactId>
         <version>4.13.2</version>
       </dependency>
-      <dependency>
-        <groupId>org.hamcrest</groupId>
-        <artifactId>hamcrest</artifactId>
-        <version>3.0</version>
-      </dependency>
       <dependency>
         <groupId>org.hamcrest</groupId>
         <artifactId>hamcrest-core</artifactId>
@@ -208,11 +203,6 @@
       <artifactId>junit-jupiter-api</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.hamcrest</groupId>
-      <artifactId>hamcrest</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.xmlunit</groupId>
       <artifactId>xmlunit-legacy</artifactId>
diff --git a/src/test/java/org/apache/maven/plugins/shade/DefaultShaderTest.java b/src/test/java/org/apache/maven/plugins/shade/DefaultShaderTest.java
index 63e100bd..02dcd9c7 100644
--- a/src/test/java/org/apache/maven/plugins/shade/DefaultShaderTest.java
+++ b/src/test/java/org/apache/maven/plugins/shade/DefaultShaderTest.java
@@ -72,11 +72,6 @@ import static java.util.Arrays.asList;
 import static java.util.Collections.singleton;
 import static java.util.Objects.requireNonNull;
 import static org.codehaus.plexus.util.FileUtils.forceMkdir;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.hasItem;
-import static org.hamcrest.CoreMatchers.hasItems;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -169,21 +164,29 @@ public class DefaultShaderTest {
         shadeRequest.setUberJar(new File("target/foo-custom_testOverlappingResourcesAreLogged.jar"));
         shader.shade(shadeRequest);
 
-        assertThat(
-                warnMessages.getAllValues(),
-                hasItem(containsString(
-                        "plexus-utils-1.4.1.jar, test-project-1.0-SNAPSHOT.jar define 1 overlapping resource:")));
-        assertThat(warnMessages.getAllValues(), hasItem(containsString("- META-INF/MANIFEST.MF")));
+        assertTrue(
+                warnMessages.getAllValues().stream()
+                        .anyMatch(
+                                m -> m.contains(
+                                        "plexus-utils-1.4.1.jar, test-project-1.0-SNAPSHOT.jar define 1 overlapping resource:")),
+                "expected a warning about the overlapping resource");
+        assertTrue(
+                warnMessages.getAllValues().stream().anyMatch(m -> m.contains("- META-INF/MANIFEST.MF")),
+                "expected a warning containing '- META-INF/MANIFEST.MF'");
         if (Os.isFamily(Os.FAMILY_WINDOWS)) {
-            assertThat(
-                    debugMessages.getAllValues(),
-                    hasItem(containsString(
-                            "We have a duplicate META-INF/MANIFEST.MF in src\\test\\jars\\plexus-utils-1.4.1.jar")));
+            assertTrue(
+                    debugMessages.getAllValues().stream()
+                            .anyMatch(
+                                    m -> m.contains(
+                                            "We have a duplicate META-INF/MANIFEST.MF in src\\test\\jars\\plexus-utils-1.4.1.jar")),
+                    "expected a debug message about the duplicate manifest");
         } else {
-            assertThat(
-                    debugMessages.getAllValues(),
-                    hasItem(containsString(
-                            "We have a duplicate META-INF/MANIFEST.MF in src/test/jars/plexus-utils-1.4.1.jar")));
+            assertTrue(
+                    debugMessages.getAllValues().stream()
+                            .anyMatch(
+                                    m -> m.contains(
+                                            "We have a duplicate META-INF/MANIFEST.MF in src/test/jars/plexus-utils-1.4.1.jar")),
+                    "expected a debug message about the duplicate manifest");
         }
     }
 
@@ -222,16 +225,19 @@ public class DefaultShaderTest {
             DefaultShader shaderWithTransformer = newShader();
             shaderWithTransformer.shade(shadeRequest);
 
-            assertThat(warnMessages.getAllValues().size(), is(0));
+            assertEquals(0, warnMessages.getAllValues().size());
 
             DefaultShader shaderWithoutTransformer = newShader();
             shadeRequest.setResourceTransformers(Collections.emptyList());
             shaderWithoutTransformer.shade(shadeRequest);
 
-            assertThat(
-                    warnMessages.getAllValues(),
-                    hasItems(containsString("j1.jar, j2.jar define 1 overlapping resource:")));
-            assertThat(warnMessages.getAllValues(), hasItems(containsString("- foo.txt")));
+            assertTrue(
+                    warnMessages.getAllValues().stream()
+                            .anyMatch(m -> m.contains("j1.jar, j2.jar define 1 overlapping resource:")),
+                    "expected a warning about the overlapping resource");
+            assertTrue(
+                    warnMessages.getAllValues().stream().anyMatch(m -> m.contains("- foo.txt")),
+                    "expected a warning containing '- foo.txt'");
         } finally {
             temporaryFolder.delete();
         }