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

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


The following commit(s) were added to refs/heads/maven-install-plugin-4.x by 
this push:
     new 71bed64  Final test polish: assert-form verify scripts and contributor 
docs (4.x)
71bed64 is described below

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

    Final test polish: assert-form verify scripts and contributor docs (4.x)
    
    Part of #506
---
 AGENTS.md                                  | 10 ++++++++++
 README.md                                  | 10 ++++++++++
 src/it/install-file-parallel/verify.groovy | 15 ++++-----------
 src/it/non-default-pom/verify.groovy       |  8 +-------
 4 files changed, 25 insertions(+), 18 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 66899f1..2109c4f 100644
--- a/README.md
+++ b/README.md
@@ -66,6 +66,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/install-file-parallel/verify.groovy 
b/src/it/install-file-parallel/verify.groovy
index 34ea684..37c09fa 100644
--- a/src/it/install-file-parallel/verify.groovy
+++ b/src/it/install-file-parallel/verify.groovy
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-// MINSTALL-205: install:install-file must not trigger an "aggregator mojo" 
warning
+// install:install-file must not trigger an "aggregator mojo" warning
 // when two modules invoke it concurrently in a parallel (-T 2) build.
 
 import java.io.*;
@@ -33,19 +33,12 @@ 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();
 }
 
 // 2. The build log must NOT contain the "aggregator mojo already being 
executed" warning
 File buildLog = new File( basedir, "build.log" );
 String log = buildLog.text;
 
-if ( log.contains( "aggregator mojo is already being executed" ) ) {
-    throw new AssertionError(
-        "Build log contains the 'aggregator mojo is already being executed' 
warning, " +
-        "but install-file should no longer be an aggregator (MINSTALL-205)." );
-}
-
-return true;
+assert !log.contains( "aggregator mojo is already being executed" ) :
+    "install-file should no longer be an aggregator, but the build log 
contains the warning"
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;

Reply via email to