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-install-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 7d9f905  Final test polish: assert-form verify scripts and contributor 
docs
7d9f905 is described below

commit 7d9f9057d7a628c0b87a09d4552f11385cbd8072
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Sat Nov 21 16:27:32 2026 +0100

    Final test polish: assert-form verify scripts and contributor docs
    
    Part of #506
---
 AGENTS.md                                              | 10 ++++++++++
 README.md                                              | 10 ++++++++++
 src/it/non-default-pom/verify.groovy                   |  8 +-------
 src/it/pom-packaged-project-installs-pom/verify.groovy | 14 ++++----------
 4 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/AGENTS.md b/AGENTS.md
index 39c8b37..df16ba5 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -30,3 +30,13 @@ Agents that scan this repository should consult 
`SECURITY.md` and the
 threat model it links before reporting issues.
 
 Points at the Apache Maven family umbrella security model.
+
+## Tests
+
+Unit tests are JUnit 5 (Jupiter) and live in `src/test/java`. New test code 
must not add JUnit 4, the vintage engine, Hamcrest, or 
`org.codehaus.plexus.util`; use JDK/Groovy APIs instead. Name tests after the 
behaviour they check, not after JIRA keys.
+
+Integration tests in `src/it` are reserved for behaviour that needs a real 
Maven build: reactor and deferred installation, `-T2` parallel builds, `-f` 
alternate POMs, embedded-POM execution and the `setup-*` support projects. 
Everything a mojo unit test can assert with a mocked session/repository belongs 
in `src/test`. Keep `verify.groovy` scripts in plain `assert` form.
+
+The Maven 4 branch (`maven-install-plugin-4.x`) uses the Maven 4 `@MojoTest` 
harness. Its `ArtifactInstaller` is mocked, so `maven-metadata-local.xml` is 
not written during unit tests; assert the coordinate-derived paths from the 
install request instead of a physical file. The 3.x line's harness writes real 
files. Both branches keep the same IT names and test-case names, but do not 
share API-specific test code: 4.x stays Maven 4 only.
+
+Run `mvn -Prun-its verify` for the full build, or `mvn -o -B test 
spotless:check` for the unit suite and formatting.
diff --git a/README.md b/README.md
index 87466ba..fc1df93 100644
--- a/README.md
+++ b/README.md
@@ -65,6 +65,16 @@ There are some guidelines which will make applying PRs 
easier for us:
 
 If you plan to contribute on a regular basis, please consider filing a 
[contributor license agreement][cla].
 
+## Tests
+
+Unit tests are JUnit 5 (Jupiter) and live in `src/test/java`. New test code 
must not add JUnit 4, the vintage engine, Hamcrest, or 
`org.codehaus.plexus.util`; use JDK/Groovy APIs instead. Name tests after the 
behaviour they check, not after JIRA keys.
+
+Integration tests in `src/it` are reserved for behaviour that needs a real 
Maven build: reactor and deferred installation, `-T2` parallel builds, `-f` 
alternate POMs, embedded-POM execution and the `setup-*` support projects. 
Everything a mojo unit test can assert with a mocked session/repository belongs 
in `src/test`. Keep `verify.groovy` scripts in plain `assert` form.
+
+The Maven 4 branch (`maven-install-plugin-4.x`) uses the Maven 4 `@MojoTest` 
harness. Its `ArtifactInstaller` is mocked, so `maven-metadata-local.xml` is 
not written during unit tests; assert the coordinate-derived paths from the 
install request instead of a physical file. The 3.x line's harness writes real 
files. Both branches keep the same IT names and test-case names, but do not 
share API-specific test code: 4.x stays Maven 4 only.
+
+Run `mvn -Prun-its verify` for the full build, or `mvn -o -B test 
spotless:check` for the unit suite and formatting.
+
 Additional Resources
 --------------------
 
diff --git a/src/it/non-default-pom/verify.groovy 
b/src/it/non-default-pom/verify.groovy
index d5e099a..d110662 100644
--- a/src/it/non-default-pom/verify.groovy
+++ b/src/it/non-default-pom/verify.groovy
@@ -30,11 +30,5 @@ String[] paths =
 for ( String path : paths )
 {
     File file = new File( localRepositoryPath, path );
-    System.out.println( "Checking for existence of " + file );
-    if ( !file.isFile() )
-    {
-        throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() 
);
-    }
+    assert file.isFile() : "Missing: " + file.getAbsolutePath();
 }
-
-return true;
diff --git a/src/it/pom-packaged-project-installs-pom/verify.groovy 
b/src/it/pom-packaged-project-installs-pom/verify.groovy
index 8215b68..6e9cc25 100644
--- a/src/it/pom-packaged-project-installs-pom/verify.groovy
+++ b/src/it/pom-packaged-project-installs-pom/verify.groovy
@@ -17,15 +17,13 @@
  * under the License.
  */
 
-// MINSTALL-315: jar:jar on a pom-packaged project sets 
project.getArtifact().getFile() to the produced JAR.
+// jar:jar on a pom-packaged project sets project.getArtifact().getFile() to 
the produced JAR.
 // A subsequent install:install must install the POM, not that JAR.
 
 File installed = new File( localRepositoryPath,
     "org/apache/maven/its/install/minstall315/test/1.0/test-1.0.pom" )
 
-if ( !installed.isFile() ) {
-    throw new FileNotFoundException( "Installed file not found: " + installed )
-}
+assert installed.isFile() : "Installed file not found: " + installed
 
 // The installed file must not be a JAR (ZIP). Check the magic bytes: 
PK\x03\x04 = 0x50 0x4B 0x03 0x04.
 byte[] magic = new byte[4]
@@ -33,9 +31,5 @@ new FileInputStream( installed ).with { stream ->
     stream.read( magic )
 }
 
-if ( magic[0] == 0x50 && magic[1] == 0x4B ) {
-    throw new Exception(
-        "MINSTALL-315 regression: install:install installed a JAR (ZIP) 
instead of the POM for a pom-packaged project" )
-}
-
-return true
+assert !( magic[0] == 0x50 && magic[1] == 0x4B ) :
+    "install:install installed a JAR (ZIP) instead of the POM for a 
pom-packaged project"

Reply via email to