You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2019/12/15 04:27:01 UTC

[maven] branch MNG-6825 updated (26235ff -> e94bb51)

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

khmarbaise pushed a change to branch MNG-6825
in repository https://gitbox.apache.org/repos/asf/maven.git.


 discard 26235ff  WIP - Continued - Fixed Checkstyle issues.
 discard 3cedd82  WIP - Removed commons-lang3.
 discard 7958b1f  WIP - Continued.
 discard d8cae6e  WIP - Continued.
 discard 66aeaf6  continued.
 discard 1ead272  Added License Header.
 discard 5b0fd42  Second step.
 discard 0c416a3  First step.
     add b8f066e  [MNG-6823] - Remove unnecessary dependency exclusions for wagon-http
     add 06842d6  [MNG-6826] - Remove condition check for JDK8+ in FileSizeFormatTest  - The conditions to check for JDK8+ in test cases is    obsolete with the lift to JDK8.
     add 78ad10d  [MNG-6807] - Remove LifecycleXpp3ReaderTest
     new a50ae0e  First step.
     new dd32748  Second step.
     new a721573  Added License Header.
     new 64ea798  continued.
     new 564dfb5  WIP - Continued.
     new 29e34dc  WIP - Continued.
     new 9cddc72  WIP - Removed commons-lang3.
     new e94bb51  WIP - Continued - Fixed Checkstyle issues.

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   (26235ff)
            \
             N -- N -- N   refs/heads/MNG-6825 (e94bb51)

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 8 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:
 .../maven/cli/transfer/FileSizeFormatTest.java     |  6 +--
 .../plugin/lifecycle/LifecycleXpp3ReaderTest.java  | 55 ----------------------
 maven-plugin-api/src/test/resources/lifecycle.xml  | 39 ---------------
 pom.xml                                            |  6 ---
 4 files changed, 3 insertions(+), 103 deletions(-)
 delete mode 100644 maven-plugin-api/src/test/java/org/apache/maven/plugin/lifecycle/LifecycleXpp3ReaderTest.java
 delete mode 100644 maven-plugin-api/src/test/resources/lifecycle.xml


[maven] 02/08: Second step.

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

khmarbaise pushed a commit to branch MNG-6825
in repository https://gitbox.apache.org/repos/asf/maven.git

commit dd327481fb0edde694eca53738bbed8657830959
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Mon Nov 25 20:37:04 2019 +0100

    Second step.
---
 maven-utils/pom.xml                                | 14 ++++++
 .../java/org/apache/maven/utils/Precondition.java  | 56 +++++++++++++++++-----
 .../org/apache/maven/utils/PreconditionTest.java   | 16 +++++++
 3 files changed, 75 insertions(+), 11 deletions(-)

diff --git a/maven-utils/pom.xml b/maven-utils/pom.xml
index 21e066d..3d3bd85 100644
--- a/maven-utils/pom.xml
+++ b/maven-utils/pom.xml
@@ -34,6 +34,20 @@ under the License.
   <name>Maven Utils</name>
 
   <dependencies>
+
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <scope>test</scope>
+      <version>5.5.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.assertj</groupId>
+      <artifactId>assertj-core</artifactId>
+      <version>3.14.0</version>
+      <scope>test</scope>
+    </dependency>
+
     <dependency>
       <groupId>org.apiguardian</groupId>
       <artifactId>apiguardian-api</artifactId>
diff --git a/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java b/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
index 73b50a1..54f1399 100644
--- a/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
+++ b/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
@@ -1,6 +1,24 @@
 package org.apache.maven.utils;
 
-import com.sun.tools.javac.util.StringUtils;
+/*
+ * 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.
+ */
+
 import org.apiguardian.api.API;
 
 import java.util.List;
@@ -19,7 +37,13 @@ public final class Precondition
     {
         // no-op
     }
-
+/*
+    int c = str != null && str.length() > 0 ? str.charAt( 0 ) : 0;
+        if ( ( c < '0' || c > '9' ) && ( c < 'a' || c > 'z' ) )
+    {
+        Validate.notBlank( str, message );
+    }
+*/
     public static boolean notBlank(String str, String message)
     {
         for ( int i = 0; i < str.length(); i++ )
@@ -32,6 +56,14 @@ public final class Precondition
         throw new IllegalArgumentException( message );
     }
 
+    public static boolean isBlank(String str, String message)
+    {
+        if ( str == null || str.trim().isEmpty() )
+        {
+            return true;
+        }
+        return true;
+    }
     /**
      * assert that the given {@code obj} is not {@code null}.
      *
@@ -113,13 +145,15 @@ public final class Precondition
      * @param message The message for the exception in case of {@code null}.
      * @return The supplied object as convenient.
      */
-    public static String requireNotEmpty(String str, String message)
-    {
-        requireNotNull( str, message );
-        if ( StringUtils.isBlank( str ) )
-        {
-            throw new IllegalArgumentException( message );
-        }
-        return str;
-    }
+//    public static String requireNotEmpty(String str, String message)
+//    {
+//        requireNotNull( str, message );
+//        if ( StringUtils.isBlank( str ) )
+//        {
+//            throw new IllegalArgumentException( message );
+//        }
+//        return str;
+//    }
+
+}
 
diff --git a/maven-utils/src/test/java/org/apache/maven/utils/PreconditionTest.java b/maven-utils/src/test/java/org/apache/maven/utils/PreconditionTest.java
new file mode 100644
index 0000000..d555c6c
--- /dev/null
+++ b/maven-utils/src/test/java/org/apache/maven/utils/PreconditionTest.java
@@ -0,0 +1,16 @@
+package org.apache.maven.utils;
+
+import org.junit.jupiter.api.Test;
+
+import static org.apache.maven.utils.Precondition.notBlank;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
+
+class PreconditionTest
+{
+    @Test
+    void first()
+    {
+        assertThatIllegalArgumentException()
+                .isThrownBy( () -> notBlank( "x", "Message" ) );
+    }
+}
\ No newline at end of file


[maven] 07/08: WIP - Removed commons-lang3.

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

khmarbaise pushed a commit to branch MNG-6825
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 9cddc72e340ce218a8bec84615859ef6a41edc0e
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Dec 15 04:08:12 2019 +0100

    WIP - Removed commons-lang3.
---
 maven-artifact/pom.xml                                              | 5 -----
 .../apache/maven/artifact/versioning/DefaultArtifactVersion.java    | 2 +-
 maven-core/pom.xml                                                  | 4 ----
 maven-embedder/pom.xml                                              | 4 ----
 pom.xml                                                             | 6 ------
 5 files changed, 1 insertion(+), 20 deletions(-)

diff --git a/maven-artifact/pom.xml b/maven-artifact/pom.xml
index 24bee1d..9dd4fe9 100644
--- a/maven-artifact/pom.xml
+++ b/maven-artifact/pom.xml
@@ -41,11 +41,6 @@ under the License.
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-utils</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-lang3</artifactId>
-      <version>3.9</version>
-    </dependency>
   </dependencies>
 
   <build>
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java
index 75b19fa..b82c51b 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java
@@ -21,7 +21,7 @@ package org.apache.maven.artifact.versioning;
 
 import java.util.StringTokenizer;
 
-import static org.apache.commons.lang3.math.NumberUtils.isDigits;
+import static org.apache.maven.utils.Precondition.isDigits;
 
 /**
  * Default implementation of artifact versioning.
diff --git a/maven-core/pom.xml b/maven-core/pom.xml
index b40dcc8..581c2c0 100644
--- a/maven-core/pom.xml
+++ b/maven-core/pom.xml
@@ -127,10 +127,6 @@ under the License.
       <artifactId>plexus-component-annotations</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-lang3</artifactId>
-    </dependency>
-    <dependency>
       <groupId>commons-jxpath</groupId>
       <artifactId>commons-jxpath</artifactId>
       <scope>test</scope>
diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml
index 1b7dec7..3c5900b 100644
--- a/maven-embedder/pom.xml
+++ b/maven-embedder/pom.xml
@@ -158,10 +158,6 @@ under the License.
       <artifactId>commons-cli</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-lang3</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
       <scope>test</scope>
diff --git a/pom.xml b/pom.xml
index 582cb2e..8cc0286 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,7 +51,6 @@ under the License.
     <maven.compiler.target>1.8</maven.compiler.target>
     <classWorldsVersion>2.6.0</classWorldsVersion>
     <commonsCliVersion>1.4</commonsCliVersion>
-    <commonsLangVersion>3.8.1</commonsLangVersion>
     <junitVersion>4.12</junitVersion>
     <mockitoVersion>3.2.0</mockitoVersion>
     <plexusVersion>2.1.0</plexusVersion>
@@ -381,11 +380,6 @@ under the License.
         <version>${jxpathVersion}</version>
       </dependency>
       <dependency>
-        <groupId>org.apache.commons</groupId>
-        <artifactId>commons-lang3</artifactId>
-        <version>${commonsLangVersion}</version>
-      </dependency>
-      <dependency>
         <groupId>org.sonatype.plexus</groupId>
         <artifactId>plexus-sec-dispatcher</artifactId>
         <version>${securityDispatcherVersion}</version>


[maven] 03/08: Added License Header.

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

khmarbaise pushed a commit to branch MNG-6825
in repository https://gitbox.apache.org/repos/asf/maven.git

commit a7215731c4b9a34f2bf3c339c8a0b70684f0be1a
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sat Dec 14 20:38:07 2019 +0100

    Added License Header.
---
 .../java/org/apache/maven/utils/PreconditionTest.java | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/maven-utils/src/test/java/org/apache/maven/utils/PreconditionTest.java b/maven-utils/src/test/java/org/apache/maven/utils/PreconditionTest.java
index d555c6c..5a157b3 100644
--- a/maven-utils/src/test/java/org/apache/maven/utils/PreconditionTest.java
+++ b/maven-utils/src/test/java/org/apache/maven/utils/PreconditionTest.java
@@ -1,5 +1,24 @@
 package org.apache.maven.utils;
 
+/*
+ * 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.
+ */
+
 import org.junit.jupiter.api.Test;
 
 import static org.apache.maven.utils.Precondition.notBlank;


[maven] 01/08: First step.

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

khmarbaise pushed a commit to branch MNG-6825
in repository https://gitbox.apache.org/repos/asf/maven.git

commit a50ae0e9f136898d721a3edc040b1d2aaaf42b9d
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Mon Nov 25 20:13:38 2019 +0100

    First step.
---
 maven-artifact/pom.xml                             |   4 +-
 maven-utils/pom.xml                                |  43 +++++++
 .../java/org/apache/maven/utils/Precondition.java  | 125 +++++++++++++++++++++
 pom.xml                                            |   1 +
 4 files changed, 171 insertions(+), 2 deletions(-)

diff --git a/maven-artifact/pom.xml b/maven-artifact/pom.xml
index 336505b..9dd4fe9 100644
--- a/maven-artifact/pom.xml
+++ b/maven-artifact/pom.xml
@@ -38,8 +38,8 @@ under the License.
       <artifactId>plexus-utils</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-lang3</artifactId>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-utils</artifactId>
     </dependency>
   </dependencies>
 
diff --git a/maven-utils/pom.xml b/maven-utils/pom.xml
new file mode 100644
index 0000000..21e066d
--- /dev/null
+++ b/maven-utils/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven</groupId>
+    <artifactId>maven</artifactId>
+    <version>3.6.3-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-utils</artifactId>
+
+  <name>Maven Utils</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apiguardian</groupId>
+      <artifactId>apiguardian-api</artifactId>
+      <version>1.1.0</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java b/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
new file mode 100644
index 0000000..73b50a1
--- /dev/null
+++ b/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
@@ -0,0 +1,125 @@
+package org.apache.maven.utils;
+
+import com.sun.tools.javac.util.StringUtils;
+import org.apiguardian.api.API;
+
+import java.util.List;
+
+import static org.apiguardian.api.API.Status.INTERNAL;
+
+/**
+ * Convenient utility methods for assertion of different conditions.
+ *
+ * @author Karl Heinz Marbaise
+ */
+@API( status = INTERNAL, since = "3.6.4" )
+public final class Precondition
+{
+    private Precondition()
+    {
+        // no-op
+    }
+
+    public static boolean notBlank(String str, String message)
+    {
+        for ( int i = 0; i < str.length(); i++ )
+        {
+            if ( !Character.isWhitespace( str.charAt( i ) ) )
+            {
+                return false;
+            }
+        }
+        throw new IllegalArgumentException( message );
+    }
+
+    /**
+     * assert that the given {@code obj} is not {@code null}.
+     *
+     * @param obj     The instance which should be not {@code null}.
+     * @param message The message will be part of the exception.
+     * @return The supplied object as convenient.
+     */
+    public static < T > T requireNotNull(T obj, String message)
+    {
+        if ( obj == null )
+            throw new IllegalArgumentException( message );
+        return obj;
+    }
+
+    /**
+     * assert that the given {@code List<T>} is not {@code empty}.
+     *
+     * @param obj     The instance which should be not {@code empty}.
+     * @param message The message will be part of the exception.
+     * @return The supplied object as convenient.
+     */
+    public static < T > List< T > requireNotEmpty(List< T > obj, String message)
+    {
+        if ( obj.isEmpty() )
+        {
+            throw new IllegalArgumentException( message );
+        }
+        return obj;
+    }
+
+    /**
+     * assert that the given {@code longValue} is greater than {@code 0}.
+     *
+     * @param longValue The instance which should be not {@code null}
+     *                  and has to be greater than {@code 0}.
+     * @param message   The message will be part of the exception.
+     * @return The supplied object as convenient.
+     */
+    public static Long requireGreaterThanZero(Long longValue, String message)
+    {
+        if ( longValue == null )
+        {
+            throw new IllegalArgumentException( message );
+        }
+
+        if ( longValue <= 0 )
+        {
+            throw new IllegalArgumentException( message );
+        }
+        return longValue;
+    }
+
+    /**
+     * assert that the given {@code integerValue} is greater than {@code 0}.
+     *
+     * @param integerValue The instance which should be not {@code null}
+     *                     and has to be greater than {@code 0}.
+     * @param message      The message will be part of the exception.
+     * @return The supplied object as convenient.
+     */
+    public static Integer requireGreaterThanZero(Integer integerValue, String message)
+    {
+        if ( integerValue == null )
+        {
+            throw new IllegalArgumentException( message );
+        }
+
+        if ( integerValue <= 0 )
+        {
+            throw new IllegalArgumentException( message );
+        }
+        return integerValue;
+    }
+
+    /**
+     * assert that the given {@code str} is not {@code null} and not {@code empty}.
+     *
+     * @param str     The str which should not be {@code null} and not be empty.
+     * @param message The message for the exception in case of {@code null}.
+     * @return The supplied object as convenient.
+     */
+    public static String requireNotEmpty(String str, String message)
+    {
+        requireNotNull( str, message );
+        if ( StringUtils.isBlank( str ) )
+        {
+            throw new IllegalArgumentException( message );
+        }
+        return str;
+    }
+
diff --git a/pom.xml b/pom.xml
index 0a1c92f..777371a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,6 +89,7 @@ under the License.
     <module>maven-settings</module>
     <module>maven-settings-builder</module>
     <module>maven-artifact</module>
+    <module>maven-utils</module>
     <module>maven-resolver-provider</module>
     <module>maven-repository-metadata</module>
     <module>maven-slf4j-provider</module>


[maven] 04/08: continued.

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

khmarbaise pushed a commit to branch MNG-6825
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 64ea798907d29fcac2121da0202b3136e5db9727
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sat Dec 14 23:53:25 2019 +0100

    continued.
---
 .../org/apache/maven/artifact/ArtifactUtils.java   |  14 +-
 maven-embedder/pom.xml                             |   4 +
 .../org/apache/maven/cli/CLIReportingUtils.java    |   4 +-
 .../transfer/AbstractMavenTransferListener.java    | 146 +++++++++++----------
 maven-utils/pom.xml                                |  12 +-
 .../java/org/apache/maven/utils/Precondition.java  |  35 ++++-
 pom.xml                                            |   5 +
 7 files changed, 131 insertions(+), 89 deletions(-)

diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java b/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java
index bd76edd..da17f7b 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java
@@ -26,8 +26,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.regex.Matcher;
 
-import org.apache.commons.lang3.Validate;
 import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.utils.Precondition;
 
 /**
  * ArtifactUtils
@@ -40,7 +40,7 @@ public final class ArtifactUtils
         if ( version != null )
         {
             if ( version.regionMatches( true, version.length() - Artifact.SNAPSHOT_VERSION.length(),
-                                        Artifact.SNAPSHOT_VERSION, 0, Artifact.SNAPSHOT_VERSION.length() ) )
+                    Artifact.SNAPSHOT_VERSION, 0, Artifact.SNAPSHOT_VERSION.length() ) )
             {
                 return true;
             }
@@ -104,7 +104,7 @@ public final class ArtifactUtils
         int c = str != null && str.length() > 0 ? str.charAt( 0 ) : 0;
         if ( ( c < '0' || c > '9' ) && ( c < 'a' || c > 'z' ) )
         {
-            Validate.notBlank( str, message );
+            Precondition.notBlank( str, message );
         }
     }
 
@@ -153,8 +153,8 @@ public final class ArtifactUtils
         }
 
         DefaultArtifact clone = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), range,
-            artifact.getScope(), artifact.getType(), artifact.getClassifier(),
-            artifact.getArtifactHandler(), artifact.isOptional() );
+                artifact.getScope(), artifact.getType(), artifact.getClassifier(), artifact.getArtifactHandler(),
+                artifact.isOptional() );
         clone.setRelease( artifact.isRelease() );
         clone.setResolvedVersion( artifact.getVersion() );
         clone.setResolved( artifact.isResolved() );
@@ -173,7 +173,9 @@ public final class ArtifactUtils
         return clone;
     }
 
-    /** Returns <code>to</code> collection */
+    /**
+     * Returns <code>to</code> collection
+     */
     public static <T extends Collection<Artifact>> T copyArtifacts( Collection<Artifact> from, T to )
     {
         for ( Artifact artifact : from )
diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml
index 235ae62..ef53d2b 100644
--- a/maven-embedder/pom.xml
+++ b/maven-embedder/pom.xml
@@ -171,6 +171,10 @@ under the License.
       <artifactId>jansi</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-utils</artifactId>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
index d562c88..bd5ca56 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
@@ -19,8 +19,6 @@ package org.apache.maven.cli;
  * under the License.
  */
 
-import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.text.SimpleDateFormat;
@@ -32,6 +30,8 @@ import org.apache.commons.lang3.StringUtils;
 import org.codehaus.plexus.util.Os;
 import org.slf4j.Logger;
 
+import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
+
 /**
  * Utility class used to report errors, statistics, application version info, etc.
  *
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java
index 984902e..fa4ec3e 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java
@@ -24,7 +24,7 @@ import java.text.DecimalFormat;
 import java.text.DecimalFormatSymbols;
 import java.util.Locale;
 
-import org.apache.commons.lang3.Validate;
+import org.apache.maven.utils.Precondition;
 import org.eclipse.aether.transfer.AbstractTransferListener;
 import org.eclipse.aether.transfer.TransferCancelledException;
 import org.eclipse.aether.transfer.TransferEvent;
@@ -33,20 +33,19 @@ import org.eclipse.aether.transfer.TransferResource;
 /**
  * AbstractMavenTransferListener
  */
-public abstract class AbstractMavenTransferListener
-    extends AbstractTransferListener
+public abstract class AbstractMavenTransferListener extends AbstractTransferListener
 {
 
     // CHECKSTYLE_OFF: LineLength
+
     /**
-     * Formats file size with the associated <a href="https://en.wikipedia.org/wiki/Metric_prefix">SI</a> prefix
-     * (GB, MB, kB) and using the patterns <code>#0.0</code> for numbers between 1 and 10
-     * and <code>###0</code> for numbers between 10 and 1000+ by default.
+     * Formats file size with the associated <a href="https://en.wikipedia.org/wiki/Metric_prefix">SI</a> prefix (GB,
+     * MB, kB) and using the patterns <code>#0.0</code> for numbers between 1 and 10 and <code>###0</code> for numbers
+     * between 10 and 1000+ by default.
      *
      * @see <a href="https://en.wikipedia.org/wiki/Metric_prefix">https://en.wikipedia.org/wiki/Metric_prefix</a>
      * @see <a href="https://en.wikipedia.org/wiki/Binary_prefix">https://en.wikipedia.org/wiki/Binary_prefix</a>
-     * @see <a
-     *      href="https://en.wikipedia.org/wiki/Octet_%28computing%29">https://en.wikipedia.org/wiki/Octet_(computing)</a>
+     * @see <a href="https://en.wikipedia.org/wiki/Octet_%28computing%29">https://en.wikipedia.org/wiki/Octet_(computing)</a>
      */
     // CHECKSTYLE_ON: LineLength
     // TODO Move me to Maven Shared Utils
@@ -55,68 +54,67 @@ public abstract class AbstractMavenTransferListener
         enum ScaleUnit
         {
             BYTE
-            {
-                @Override
-                public long bytes()
-                {
-                    return 1L;
-                }
-
-                @Override
-                public String symbol()
-                {
-                    return "B";
-                }
-            },
+                    {
+                        @Override
+                        public long bytes()
+                        {
+                            return 1L;
+                        }
+
+                        @Override
+                        public String symbol()
+                        {
+                            return "B";
+                        }
+                    },
             KILOBYTE
-            {
-                @Override
-                public long bytes()
-                {
-                    return 1000L;
-                }
-
-                @Override
-                public String symbol()
-                {
-                    return "kB";
-                }
-            },
+                    {
+                        @Override
+                        public long bytes()
+                        {
+                            return 1000L;
+                        }
+
+                        @Override
+                        public String symbol()
+                        {
+                            return "kB";
+                        }
+                    },
             MEGABYTE
-            {
-                @Override
-                public long bytes()
-                {
-                    return KILOBYTE.bytes() * KILOBYTE.bytes();
-                }
-
-                @Override
-                public String symbol()
-                {
-                    return "MB";
-                }
-            },
+                    {
+                        @Override
+                        public long bytes()
+                        {
+                            return KILOBYTE.bytes() * KILOBYTE.bytes();
+                        }
+
+                        @Override
+                        public String symbol()
+                        {
+                            return "MB";
+                        }
+                    },
             GIGABYTE
-            {
-                @Override
-                public long bytes()
-                {
-                    return MEGABYTE.bytes() * KILOBYTE.bytes();
-                };
-
-                @Override
-                public String symbol()
-                {
-                    return "GB";
-                }
-            };
-
-            public abstract long bytes();
-            public abstract String symbol();
+                    {
+                        @Override
+                        public long bytes()
+                        {
+                            return MEGABYTE.bytes() * KILOBYTE.bytes();
+                        }
+
+                        ;
+
+                        @Override
+                        public String symbol()
+                        {
+                            return "GB";
+                        }
+                    };
 
             public static ScaleUnit getScaleUnit( long size )
             {
-                Validate.isTrue( size >= 0L, "file size cannot be negative: %s", size );
+                Precondition.requireGreaterThanZero( size, "file size cannot be negative: %s", size );
 
                 if ( size >= GIGABYTE.bytes() )
                 {
@@ -135,6 +133,10 @@ public abstract class AbstractMavenTransferListener
                     return BYTE;
                 }
             }
+
+            public abstract long bytes();
+
+            public abstract String symbol();
         }
 
         private DecimalFormat smallFormat;
@@ -159,7 +161,7 @@ public abstract class AbstractMavenTransferListener
         @SuppressWarnings( "checkstyle:magicnumber" )
         public String format( long size, ScaleUnit unit, boolean omitSymbol )
         {
-            Validate.isTrue( size >= 0L, "file size cannot be negative: %s", size );
+            Precondition.requireGreaterThanZero( size, "file size cannot be negative: %s", size );
 
             if ( unit == null )
             {
@@ -191,9 +193,10 @@ public abstract class AbstractMavenTransferListener
 
         public String formatProgress( long progressedSize, long size )
         {
-            Validate.isTrue( progressedSize >= 0L, "progressed file size cannot be negative: %s", progressedSize );
-            Validate.isTrue( size >= 0L && progressedSize <= size || size < 0L,
-                "progressed file size cannot be greater than size: %s > %s", progressedSize, size );
+            Precondition.requireGreaterThanZero( progressedSize, "progressed file size cannot be negative: %s",
+                    progressedSize );
+            Precondition.isTrue( size >= 0L && progressedSize <= size || size < 0L,
+                    "progressed file size cannot be greater than size: %s > %s", progressedSize, size );
 
             if ( size >= 0L && progressedSize != size )
             {
@@ -233,13 +236,12 @@ public abstract class AbstractMavenTransferListener
     }
 
     @Override
-    public void transferCorrupted( TransferEvent event )
-        throws TransferCancelledException
+    public void transferCorrupted( TransferEvent event ) throws TransferCancelledException
     {
         TransferResource resource = event.getResource();
         // TODO This needs to be colorized
-        out.println( "[WARNING] " + event.getException().getMessage() + " from " + resource.getRepositoryId() + " for "
-            + resource.getRepositoryUrl() + resource.getResourceName() );
+        out.println( "[WARNING] " + event.getException().getMessage() + " from " + resource
+                .getRepositoryId() + " for " + resource.getRepositoryUrl() + resource.getResourceName() );
     }
 
     @Override
diff --git a/maven-utils/pom.xml b/maven-utils/pom.xml
index 3d3bd85..0472794 100644
--- a/maven-utils/pom.xml
+++ b/maven-utils/pom.xml
@@ -26,7 +26,7 @@ under the License.
   <parent>
     <groupId>org.apache.maven</groupId>
     <artifactId>maven</artifactId>
-    <version>3.6.3-SNAPSHOT</version>
+    <version>3.7.0-SNAPSHOT</version>
   </parent>
 
   <artifactId>maven-utils</artifactId>
@@ -34,6 +34,11 @@ under the License.
   <name>Maven Utils</name>
 
   <dependencies>
+    <dependency>
+      <groupId>org.apiguardian</groupId>
+      <artifactId>apiguardian-api</artifactId>
+      <version>1.1.0</version>
+    </dependency>
 
     <dependency>
       <groupId>org.junit.jupiter</groupId>
@@ -48,10 +53,5 @@ under the License.
       <scope>test</scope>
     </dependency>
 
-    <dependency>
-      <groupId>org.apiguardian</groupId>
-      <artifactId>apiguardian-api</artifactId>
-      <version>1.1.0</version>
-    </dependency>
   </dependencies>
 </project>
diff --git a/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java b/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
index 54f1399..838975c 100644
--- a/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
+++ b/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
@@ -19,10 +19,10 @@ package org.apache.maven.utils;
  * under the License.
  */
 
-import org.apiguardian.api.API;
-
 import java.util.List;
 
+import org.apiguardian.api.API;
+
 import static org.apiguardian.api.API.Status.INTERNAL;
 
 /**
@@ -30,7 +30,7 @@ import static org.apiguardian.api.API.Status.INTERNAL;
  *
  * @author Karl Heinz Marbaise
  */
-@API( status = INTERNAL, since = "3.6.4" )
+@API( status = INTERNAL, since = "3.7.0" )
 public final class Precondition
 {
     private Precondition()
@@ -116,6 +116,35 @@ public final class Precondition
         return longValue;
     }
 
+    public static void isTrue( boolean expression, String message, final long value )
+    {
+        if ( !expression )
+        {
+            throw new IllegalArgumentException( String.format( message, Long.valueOf( value ) ) );
+        }
+    }
+
+    public static void isTrue( boolean expression, String message, final Object... values )
+    {
+        if ( !expression )
+        {
+            throw new IllegalArgumentException( String.format( message, values ) );
+        }
+    }
+
+    public static Long requireGreaterThanZero(Long longValue, String message, final long value) {
+        if ( longValue == null )
+        {
+            throw new IllegalArgumentException( String.format( message, value ) );
+        }
+
+        if ( longValue <= 0 )
+        {
+            throw new IllegalArgumentException( String.format( message, value ) );
+        }
+        return longValue;
+    }
+
     /**
      * assert that the given {@code integerValue} is greater than {@code 0}.
      *
diff --git a/pom.xml b/pom.xml
index 777371a..7f13b06 100644
--- a/pom.xml
+++ b/pom.xml
@@ -233,6 +233,11 @@ under the License.
         <artifactId>maven-slf4j-provider</artifactId>
         <version>${project.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.maven</groupId>
+        <artifactId>maven-utils</artifactId>
+        <version>${project.version}</version>
+      </dependency>
       <!--bootstrap-end-comment-->
       <!--  Plexus -->
       <dependency>


[maven] 05/08: WIP - Continued.

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

khmarbaise pushed a commit to branch MNG-6825
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 564dfb5487342f8a6330c27b1f26156cc599ab7d
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Dec 15 00:16:31 2019 +0100

    WIP - Continued.
---
 maven-core/pom.xml                                 |  4 ++
 .../DefaultBeanConfigurationRequest.java           |  9 ++--
 .../rtinfo/internal/DefaultRuntimeInformation.java | 15 +++---
 .../org/apache/maven/cli/CLIReportingUtils.java    |  4 +-
 .../cli/transfer/ConsoleMavenTransferListener.java |  2 +-
 .../java/org/apache/maven/utils/Precondition.java  | 59 ++++++++++++++++------
 .../java/org/apache/maven/utils/StringUtils.java   | 53 +++++++++++++++++++
 7 files changed, 115 insertions(+), 31 deletions(-)

diff --git a/maven-core/pom.xml b/maven-core/pom.xml
index 8b70b27..b40dcc8 100644
--- a/maven-core/pom.xml
+++ b/maven-core/pom.xml
@@ -62,6 +62,10 @@ under the License.
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
+      <artifactId>maven-utils</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
       <artifactId>maven-plugin-api</artifactId>
     </dependency>
     <dependency>
diff --git a/maven-core/src/main/java/org/apache/maven/configuration/DefaultBeanConfigurationRequest.java b/maven-core/src/main/java/org/apache/maven/configuration/DefaultBeanConfigurationRequest.java
index 5ec69f5..2b478f0 100644
--- a/maven-core/src/main/java/org/apache/maven/configuration/DefaultBeanConfigurationRequest.java
+++ b/maven-core/src/main/java/org/apache/maven/configuration/DefaultBeanConfigurationRequest.java
@@ -19,13 +19,12 @@ package org.apache.maven.configuration;
  * under the License.
  */
 
-import org.apache.commons.lang3.Validate;
 import org.apache.maven.model.Build;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.PluginExecution;
 import org.apache.maven.model.PluginManagement;
-import org.codehaus.plexus.util.StringUtils;
+import org.apache.maven.utils.Precondition;
 
 /**
  * A basic bean configuration request.
@@ -100,7 +99,7 @@ public class DefaultBeanConfigurationRequest
         Plugin plugin = findPlugin( model, pluginGroupId, pluginArtifactId );
         if ( plugin != null )
         {
-            if ( StringUtils.isNotEmpty( pluginExecutionId ) )
+            if ( Precondition.isNotEmpty( pluginExecutionId ) )
             {
                 for ( PluginExecution execution : plugin.getExecutions() )
                 {
@@ -121,8 +120,8 @@ public class DefaultBeanConfigurationRequest
 
     private Plugin findPlugin( Model model, String groupId, String artifactId )
     {
-        Validate.notBlank( groupId, "groupId can neither be null, empty nor blank" );
-        Validate.notBlank( artifactId, "artifactId can neither be null, empty nor blank" );
+        Precondition.notBlank( groupId, "groupId can neither be null, empty nor blank" );
+        Precondition.notBlank( artifactId, "artifactId can neither be null, empty nor blank" );
 
         if ( model != null )
         {
diff --git a/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java b/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java
index 12a6b6f..b9abef8 100644
--- a/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java
+++ b/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java
@@ -19,9 +19,12 @@ package org.apache.maven.rtinfo.internal;
  * under the License.
  */
 
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.Validate;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
 import org.apache.maven.rtinfo.RuntimeInformation;
+import org.apache.maven.utils.Precondition;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.logging.Logger;
@@ -31,10 +34,6 @@ import org.eclipse.aether.version.Version;
 import org.eclipse.aether.version.VersionConstraint;
 import org.eclipse.aether.version.VersionScheme;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
 /**
  * Provides information about the current Maven runtime.
  */
@@ -100,7 +99,7 @@ public class DefaultRuntimeInformation
     {
         VersionScheme versionScheme = new GenericVersionScheme();
 
-        Validate.notBlank( versionRange, "versionRange can neither be null, empty nor blank" );
+        Precondition.notBlank( versionRange, "versionRange can neither be null, empty nor blank" );
 
         VersionConstraint constraint;
         try
@@ -116,7 +115,7 @@ public class DefaultRuntimeInformation
         try
         {
             String mavenVersion = getMavenVersion();
-            Validate.validState( StringUtils.isNotEmpty( mavenVersion ), "Could not determine current Maven version" );
+            Precondition.isTrue(  Precondition.isNotEmpty( mavenVersion ), "Could not determine current Maven version" );
 
             current = versionScheme.parseVersion( mavenVersion );
         }
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
index bd5ca56..d322e88 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
@@ -26,7 +26,7 @@ import java.util.Date;
 import java.util.Locale;
 import java.util.Properties;
 
-import org.apache.commons.lang3.StringUtils;
+import org.apache.maven.utils.Precondition;
 import org.codehaus.plexus.util.Os;
 import org.slf4j.Logger;
 
@@ -94,7 +94,7 @@ public final class CLIReportingUtils
         {
             msg += " (";
             msg += ( rev != null ? rev : "" );
-            if ( StringUtils.isNotBlank( timestamp ) )
+            if ( Precondition.isNotBlank( timestamp ) )
             {
                 String ts = formatTimestamp( Long.valueOf( timestamp ) );
                 msg += ( rev != null ? "; " : "" ) + ts;
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListener.java b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListener.java
index 1ad943b..e9195fb 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListener.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/ConsoleMavenTransferListener.java
@@ -26,7 +26,7 @@ import java.util.LinkedHashMap;
 import java.util.Locale;
 import java.util.Map;
 
-import org.apache.commons.lang3.StringUtils;
+import org.apache.maven.utils.StringUtils;
 import org.eclipse.aether.transfer.TransferCancelledException;
 import org.eclipse.aether.transfer.TransferEvent;
 import org.eclipse.aether.transfer.TransferResource;
diff --git a/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java b/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
index 838975c..677d3fb 100644
--- a/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
+++ b/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
@@ -56,14 +56,6 @@ public final class Precondition
         throw new IllegalArgumentException( message );
     }
 
-    public static boolean isBlank(String str, String message)
-    {
-        if ( str == null || str.trim().isEmpty() )
-        {
-            return true;
-        }
-        return true;
-    }
     /**
      * assert that the given {@code obj} is not {@code null}.
      *
@@ -167,13 +159,13 @@ public final class Precondition
         return integerValue;
     }
 
-    /**
-     * assert that the given {@code str} is not {@code null} and not {@code empty}.
-     *
-     * @param str     The str which should not be {@code null} and not be empty.
-     * @param message The message for the exception in case of {@code null}.
-     * @return The supplied object as convenient.
-     */
+//    /**
+//     * assert that the given {@code str} is not {@code null} and not {@code empty}.
+//     *
+//     * @param str     The str which should not be {@code null} and not be empty.
+//     * @param message The message for the exception in case of {@code null}.
+//     * @return The supplied object as convenient.
+//     */
 //    public static String requireNotEmpty(String str, String message)
 //    {
 //        requireNotNull( str, message );
@@ -184,5 +176,42 @@ public final class Precondition
 //        return str;
 //    }
 
+
+    public static boolean isNotEmpty( String str )
+    {
+        return ( ( str != null ) && ( !str.isEmpty() ) );
+    }
+
+    public static boolean isNotBlank(final CharSequence cs) {
+        return !isBlank(cs);
+    }
+
+    public static boolean isBlank(final CharSequence cs) {
+        int strLen;
+        if (cs == null || (strLen = cs.length()) == 0) {
+            return true;
+        }
+        for (int i = 0; i < strLen; i++) {
+            if (!Character.isWhitespace(cs.charAt(i))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public static boolean isBlank(String str, String message)
+    {
+        if ( str == null || str.trim().isEmpty() )
+        {
+            return true;
+        }
+        return true;
+    }
+
+    public static boolean isEmpty(final CharSequence cs) {
+        return cs == null || cs.length() == 0;
+    }
+
+
 }
 
diff --git a/maven-utils/src/main/java/org/apache/maven/utils/StringUtils.java b/maven-utils/src/main/java/org/apache/maven/utils/StringUtils.java
new file mode 100644
index 0000000..ff3c6ae
--- /dev/null
+++ b/maven-utils/src/main/java/org/apache/maven/utils/StringUtils.java
@@ -0,0 +1,53 @@
+package org.apache.maven.utils;
+
+/*
+ * 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.
+ */
+
+import org.apiguardian.api.API;
+
+import static org.apache.maven.utils.Precondition.isEmpty;
+import static org.apiguardian.api.API.Status.INTERNAL;
+
+@API( status = INTERNAL, since = "3.7.0" )
+public final class StringUtils
+{
+    private StringUtils()
+    {
+        // intentionally empty.
+    }
+
+    public static final String EMPTY = "";
+    public static final int INDEX_NOT_FOUND = -1;
+
+    public static String substringAfterLast(final String str, final String separator) {
+        if ( isEmpty(str)) {
+            return str;
+        }
+        if (isEmpty(separator)) {
+            return EMPTY;
+        }
+        final int pos = str.lastIndexOf(separator);
+        if (pos == INDEX_NOT_FOUND || pos == str.length() - separator.length()) {
+            return EMPTY;
+        }
+        return str.substring(pos + separator.length());
+    }
+
+
+}


[maven] 08/08: WIP - Continued - Fixed Checkstyle issues.

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

khmarbaise pushed a commit to branch MNG-6825
in repository https://gitbox.apache.org/repos/asf/maven.git

commit e94bb519d83da263c4858f06fa7e21703b895099
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Dec 15 04:28:57 2019 +0100

    WIP - Continued - Fixed Checkstyle issues.
---
 .../maven/execution/DefaultRuntimeInformation.java |  6 +-
 .../rtinfo/internal/DefaultRuntimeInformation.java |  9 +-
 .../java/org/apache/maven/utils/Precondition.java  | 98 ++++++++++++----------
 .../java/org/apache/maven/utils/StringUtils.java   | 29 +++++--
 4 files changed, 82 insertions(+), 60 deletions(-)

diff --git a/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java b/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java
index 7767aff..cf93b0d 100644
--- a/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java
+++ b/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java
@@ -34,8 +34,7 @@ import org.codehaus.plexus.util.StringUtils;
  */
 @Deprecated
 @Component( role = RuntimeInformation.class )
-public class DefaultRuntimeInformation
-    implements RuntimeInformation, Initializable
+public class DefaultRuntimeInformation implements RuntimeInformation, Initializable
 {
 
     @Requirement
@@ -48,8 +47,7 @@ public class DefaultRuntimeInformation
         return applicationVersion;
     }
 
-    public void initialize()
-        throws InitializationException
+    public void initialize() throws InitializationException
     {
         String mavenVersion = rtInfo.getMavenVersion();
 
diff --git a/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java b/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java
index b9abef8..7c92ff1 100644
--- a/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java
+++ b/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java
@@ -34,12 +34,13 @@ import org.eclipse.aether.version.Version;
 import org.eclipse.aether.version.VersionConstraint;
 import org.eclipse.aether.version.VersionScheme;
 
+import static org.apache.maven.utils.Precondition.isNotEmpty;
+
 /**
  * Provides information about the current Maven runtime.
  */
 @Component( role = RuntimeInformation.class )
-public class DefaultRuntimeInformation
-    implements RuntimeInformation
+public class DefaultRuntimeInformation implements RuntimeInformation
 {
 
     @Requirement
@@ -64,7 +65,7 @@ public class DefaultRuntimeInformation
                 else
                 {
                     logger.warn(
-                        "Could not locate " + resource + " on classpath, Maven runtime information not available" );
+                            "Could not locate " + resource + " on classpath, Maven runtime information not available" );
                 }
             }
             catch ( IOException e )
@@ -115,7 +116,7 @@ public class DefaultRuntimeInformation
         try
         {
             String mavenVersion = getMavenVersion();
-            Precondition.isTrue(  Precondition.isNotEmpty( mavenVersion ), "Could not determine current Maven version" );
+            Precondition.isTrue( isNotEmpty( mavenVersion ), "Could not determine current Maven version" );
 
             current = versionScheme.parseVersion( mavenVersion );
         }
diff --git a/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java b/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
index 258e5a2..22abeeb 100644
--- a/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
+++ b/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
@@ -45,10 +45,12 @@ public final class Precondition
      * @param message The message will be part of the exception.
      * @return The supplied object as convenient.
      */
-    public static < T > T requireNotNull(T obj, String message)
+    public static <T> T requireNotNull( T obj, String message )
     {
         if ( obj == null )
+        {
             throw new IllegalArgumentException( message );
+        }
         return obj;
     }
 
@@ -59,7 +61,7 @@ public final class Precondition
      * @param message The message will be part of the exception.
      * @return The supplied object as convenient.
      */
-    public static < T > List< T > requireNotEmpty(List< T > obj, String message)
+    public static <T> List<T> requireNotEmpty( List<T> obj, String message )
     {
         if ( obj.isEmpty() )
         {
@@ -71,12 +73,11 @@ public final class Precondition
     /**
      * assert that the given {@code longValue} is greater than {@code 0}.
      *
-     * @param longValue The instance which should be not {@code null}
-     *                  and has to be greater than {@code 0}.
+     * @param longValue The instance which should be not {@code null} and has to be greater than {@code 0}.
      * @param message   The message will be part of the exception.
      * @return The supplied object as convenient.
      */
-    public static Long requireGreaterThanZero(Long longValue, String message)
+    public static Long requireGreaterThanZero( Long longValue, String message )
     {
         if ( longValue == null )
         {
@@ -90,7 +91,7 @@ public final class Precondition
         return longValue;
     }
 
-    public static Long requireGreaterOrEqualZero(Long longValue, String message)
+    public static Long requireGreaterOrEqualZero( Long longValue, String message )
     {
         if ( longValue == null )
         {
@@ -120,7 +121,8 @@ public final class Precondition
         }
     }
 
-    public static Long greaterOrEqualToZero(Long currentValue, String message, final long value) {
+    public static Long greaterOrEqualToZero( Long currentValue, String message, final long value )
+    {
         if ( currentValue == null )
         {
             throw new IllegalArgumentException( String.format( message, value ) );
@@ -133,7 +135,8 @@ public final class Precondition
         return currentValue;
     }
 
-    public static Long requireGreaterThanZero(Long longValue, String message, final long value) {
+    public static Long requireGreaterThanZero( Long longValue, String message, final long value )
+    {
         if ( longValue == null )
         {
             throw new IllegalArgumentException( String.format( message, value ) );
@@ -149,12 +152,11 @@ public final class Precondition
     /**
      * assert that the given {@code integerValue} is greater than {@code 0}.
      *
-     * @param integerValue The instance which should be not {@code null}
-     *                     and has to be greater than {@code 0}.
+     * @param integerValue The instance which should be not {@code null} and has to be greater than {@code 0}.
      * @param message      The message will be part of the exception.
      * @return The supplied object as convenient.
      */
-    public static Integer requireGreaterThanZero(Integer integerValue, String message)
+    public static Integer requireGreaterThanZero( Integer integerValue, String message )
     {
         if ( integerValue == null )
         {
@@ -168,22 +170,22 @@ public final class Precondition
         return integerValue;
     }
 
-//    /**
-//     * assert that the given {@code str} is not {@code null} and not {@code empty}.
-//     *
-//     * @param str     The str which should not be {@code null} and not be empty.
-//     * @param message The message for the exception in case of {@code null}.
-//     * @return The supplied object as convenient.
-//     */
-//    public static String requireNotEmpty(String str, String message)
-//    {
-//        requireNotNull( str, message );
-//        if ( StringUtils.isBlank( str ) )
-//        {
-//            throw new IllegalArgumentException( message );
-//        }
-//        return str;
-//    }
+    //    /**
+    //     * assert that the given {@code str} is not {@code null} and not {@code empty}.
+    //     *
+    //     * @param str     The str which should not be {@code null} and not be empty.
+    //     * @param message The message for the exception in case of {@code null}.
+    //     * @return The supplied object as convenient.
+    //     */
+    //    public static String requireNotEmpty(String str, String message)
+    //    {
+    //        requireNotNull( str, message );
+    //        if ( StringUtils.isBlank( str ) )
+    //        {
+    //            throw new IllegalArgumentException( message );
+    //        }
+    //        return str;
+    //    }
 
 
     public static boolean isNotEmpty( String str )
@@ -191,24 +193,28 @@ public final class Precondition
         return ( ( str != null ) && ( !str.isEmpty() ) );
     }
 
-    public static boolean isNotBlank(final CharSequence cs) {
-        return !isBlank(cs);
+    public static boolean isNotBlank( final CharSequence cs )
+    {
+        return !isBlank( cs );
     }
 
-    public static boolean isBlank(final CharSequence cs) {
-        int strLen;
-        if (cs == null || (strLen = cs.length()) == 0) {
+    public static boolean isBlank( final CharSequence cs )
+    {
+        if ( cs == null || ( cs.length() ) == 0 )
+        {
             return true;
         }
-        for (int i = 0; i < strLen; i++) {
-            if (!Character.isWhitespace(cs.charAt(i))) {
+        for ( int i = 0; i < cs.length(); i++ )
+        {
+            if ( !Character.isWhitespace( cs.charAt( i ) ) )
+            {
                 return false;
             }
         }
         return true;
     }
 
-    public static boolean notBlank(String str, String message)
+    public static boolean notBlank( String str, String message )
     {
         for ( int i = 0; i < str.length(); i++ )
         {
@@ -221,7 +227,7 @@ public final class Precondition
     }
 
 
-    public static boolean isBlank(String str, String message)
+    public static boolean isBlank( String str, String message )
     {
         if ( str == null || str.trim().isEmpty() )
         {
@@ -230,21 +236,27 @@ public final class Precondition
         return true;
     }
 
-    public static boolean isEmpty(final CharSequence cs) {
+    public static boolean isEmpty( final CharSequence cs )
+    {
         return cs == null || cs.length() == 0;
     }
 
-    public static boolean isDigits(final String str) {
-        return isNumeric(str);
+    public static boolean isDigits( final String str )
+    {
+        return isNumeric( str );
     }
 
-    public static boolean isNumeric(final CharSequence cs) {
-        if (isEmpty(cs)) {
+    public static boolean isNumeric( final CharSequence cs )
+    {
+        if ( isEmpty( cs ) )
+        {
             return false;
         }
         final int sz = cs.length();
-        for (int i = 0; i < sz; i++) {
-            if (!Character.isDigit(cs.charAt(i))) {
+        for ( int i = 0; i < sz; i++ )
+        {
+            if ( !Character.isDigit( cs.charAt( i ) ) )
+            {
                 return false;
             }
         }
diff --git a/maven-utils/src/main/java/org/apache/maven/utils/StringUtils.java b/maven-utils/src/main/java/org/apache/maven/utils/StringUtils.java
index ff3c6ae..f9ca6de 100644
--- a/maven-utils/src/main/java/org/apache/maven/utils/StringUtils.java
+++ b/maven-utils/src/main/java/org/apache/maven/utils/StringUtils.java
@@ -24,29 +24,40 @@ import org.apiguardian.api.API;
 import static org.apache.maven.utils.Precondition.isEmpty;
 import static org.apiguardian.api.API.Status.INTERNAL;
 
+/**
+ * @author Karl Heinz Marbaise
+ */
 @API( status = INTERNAL, since = "3.7.0" )
 public final class StringUtils
 {
+    public static final String EMPTY = "";
+    public static final int INDEX_NOT_FOUND = -1;
     private StringUtils()
     {
         // intentionally empty.
     }
 
-    public static final String EMPTY = "";
-    public static final int INDEX_NOT_FOUND = -1;
-
-    public static String substringAfterLast(final String str, final String separator) {
-        if ( isEmpty(str)) {
+    /**
+     * @param str The string.
+     * @param separator The separator.
+     * @return The substring.
+     */
+    public static String substringAfterLast( final String str, final String separator )
+    {
+        if ( isEmpty( str ) )
+        {
             return str;
         }
-        if (isEmpty(separator)) {
+        if ( isEmpty( separator ) )
+        {
             return EMPTY;
         }
-        final int pos = str.lastIndexOf(separator);
-        if (pos == INDEX_NOT_FOUND || pos == str.length() - separator.length()) {
+        final int pos = str.lastIndexOf( separator );
+        if ( pos == INDEX_NOT_FOUND || pos == str.length() - separator.length() )
+        {
             return EMPTY;
         }
-        return str.substring(pos + separator.length());
+        return str.substring( pos + separator.length() );
     }
 
 


[maven] 06/08: WIP - Continued.

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

khmarbaise pushed a commit to branch MNG-6825
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 29e34dca176d1b341a51411f699f52989e5a0af7
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Dec 15 04:02:46 2019 +0100

    WIP - Continued.
---
 maven-artifact/pom.xml                             |   5 +
 maven-embedder/pom.xml                             |  11 +
 .../transfer/AbstractMavenTransferListener.java    |   6 +-
 .../java/org/apache/maven/cli/CLIManagerTest.java  |  26 +-
 .../apache/maven/cli/CLIReportingUtilsTest.java    |  29 +-
 .../org/apache/maven/cli/CleanArgumentTest.java    |  24 +-
 .../java/org/apache/maven/cli/MavenCliTest.java    |  14 +-
 .../maven/cli/transfer/FileSizeFormatTest.java     | 324 +++++++++++----------
 maven-model-builder/pom.xml                        |  10 +
 .../maven/model/building/FileModelSourceTest.java  |  36 ++-
 .../interpolation/MavenBuildTimestampTest.java     |  13 +-
 maven-utils/pom.xml                                |   4 -
 .../java/org/apache/maven/utils/Precondition.java  |  75 +++--
 .../org/apache/maven/utils/PreconditionTest.java   |   5 +-
 pom.xml                                            |  17 ++
 15 files changed, 338 insertions(+), 261 deletions(-)

diff --git a/maven-artifact/pom.xml b/maven-artifact/pom.xml
index 9dd4fe9..24bee1d 100644
--- a/maven-artifact/pom.xml
+++ b/maven-artifact/pom.xml
@@ -41,6 +41,11 @@ under the License.
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-utils</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+      <version>3.9</version>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml
index ef53d2b..1b7dec7 100644
--- a/maven-embedder/pom.xml
+++ b/maven-embedder/pom.xml
@@ -175,6 +175,17 @@ under the License.
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-utils</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.assertj</groupId>
+      <artifactId>assertj-core</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
 
   <build>
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java
index fa4ec3e..899e086 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java
@@ -114,7 +114,7 @@ public abstract class AbstractMavenTransferListener extends AbstractTransferList
 
             public static ScaleUnit getScaleUnit( long size )
             {
-                Precondition.requireGreaterThanZero( size, "file size cannot be negative: %s", size );
+                Precondition.greaterOrEqualToZero( size, "file size cannot be negative: %s", size );
 
                 if ( size >= GIGABYTE.bytes() )
                 {
@@ -161,7 +161,7 @@ public abstract class AbstractMavenTransferListener extends AbstractTransferList
         @SuppressWarnings( "checkstyle:magicnumber" )
         public String format( long size, ScaleUnit unit, boolean omitSymbol )
         {
-            Precondition.requireGreaterThanZero( size, "file size cannot be negative: %s", size );
+            Precondition.greaterOrEqualToZero( size, "file size cannot be negative: %s", size );
 
             if ( unit == null )
             {
@@ -193,7 +193,7 @@ public abstract class AbstractMavenTransferListener extends AbstractTransferList
 
         public String formatProgress( long progressedSize, long size )
         {
-            Precondition.requireGreaterThanZero( progressedSize, "progressed file size cannot be negative: %s",
+            Precondition.greaterOrEqualToZero( progressedSize, "progressed file size cannot be negative: %s",
                     progressedSize );
             Precondition.isTrue( size >= 0L && progressedSize <= size || size < 0L,
                     "progressed file size cannot be greater than size: %s > %s", progressedSize, size );
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerTest.java
index dbb3879..e663d23 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerTest.java
@@ -19,32 +19,30 @@ package org.apache.maven.cli;
  * under the License.
  */
 
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
 import org.apache.commons.cli.CommandLine;
-import org.junit.Before;
-import org.junit.Test;
+import org.apache.commons.cli.ParseException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
 
-public class CLIManagerTest
+class CLIManagerTest
 {
     private CLIManager cliManager;
 
-    @Before
-    public void setup()
+    @BeforeEach
+    void beforeEach()
     {
         cliManager = new CLIManager();
     }
 
     @Test
-    public void spacedOptions()
-        throws Exception
+    void spacedOptions() throws ParseException
     {
         CommandLine cmdLine = cliManager.parse( "-X -Dx=1 -D y=2 test".split( " " ) );
-        assertTrue( cmdLine.hasOption( CLIManager.DEBUG ) );
-        assertThat( cmdLine.getOptionValues( CLIManager.SET_SYSTEM_PROPERTY )[0], is( "x=1" ) );
-        assertThat( cmdLine.getOptionValues( CLIManager.SET_SYSTEM_PROPERTY )[1], is( "y=2" ) );
+        assertThat( cmdLine.hasOption( CLIManager.DEBUG ) ).isTrue();
+        assertThat( cmdLine.getOptionValues( CLIManager.SET_SYSTEM_PROPERTY )[0] ).isEqualTo( "x=1" );
+        assertThat( cmdLine.getOptionValues( CLIManager.SET_SYSTEM_PROPERTY )[1] ).isEqualTo( "y=2" );
     }
 
 }
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/CLIReportingUtilsTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/CLIReportingUtilsTest.java
index 65488c7..1a79971 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/CLIReportingUtilsTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/CLIReportingUtilsTest.java
@@ -19,22 +19,23 @@ package org.apache.maven.cli;
  * under the License.
  */
 
-import junit.framework.TestCase;
+import org.junit.jupiter.api.Test;
 
-public class CLIReportingUtilsTest
-    extends TestCase
-{
+import static org.assertj.core.api.Assertions.assertThat;
 
-    public void testFormatDuration()
+class CLIReportingUtilsTest
+{
+    @Test
+    void testFormatDuration()
     {
-        assertEquals( "0.001 s", CLIReportingUtils.formatDuration( 1 ) );
-        assertEquals( "0.999 s", CLIReportingUtils.formatDuration( 1000 - 1 ) );
-        assertEquals( "1.000 s", CLIReportingUtils.formatDuration( 1000 ) );
-        assertEquals( "59.999 s", CLIReportingUtils.formatDuration( 60 * 1000 - 1 ) );
-        assertEquals( "01:00 min", CLIReportingUtils.formatDuration( 60 * 1000 ) );
-        assertEquals( "59:59 min", CLIReportingUtils.formatDuration( 60 * 60 * 1000 - 1 ) );
-        assertEquals( "01:00 h", CLIReportingUtils.formatDuration( 60 * 60 * 1000 ) );
-        assertEquals( "23:59 h", CLIReportingUtils.formatDuration( 24 * 60 * 60 * 1000 - 1 ) );
-        assertEquals( "1 d 00:00 h", CLIReportingUtils.formatDuration( 24 * 60 * 60 * 1000 ) );
+        assertThat( CLIReportingUtils.formatDuration( 1 ) ).isEqualTo( "0.001 s" );
+        assertThat( CLIReportingUtils.formatDuration( 1000 - 1 ) ).isEqualTo( "0.999 s" );
+        assertThat( CLIReportingUtils.formatDuration( 1000 ) ).isEqualTo( "1.000 s" );
+        assertThat( CLIReportingUtils.formatDuration( 60 * 1000 - 1 ) ).isEqualTo( "59.999 s" );
+        assertThat( CLIReportingUtils.formatDuration( 60 * 1000 ) ).isEqualTo( "01:00 min" );
+        assertThat( CLIReportingUtils.formatDuration( 60 * 60 * 1000 - 1 ) ).isEqualTo( "59:59 min" );
+        assertThat( CLIReportingUtils.formatDuration( 60 * 60 * 1000 ) ).isEqualTo( "01:00 h" );
+        assertThat( CLIReportingUtils.formatDuration( 24 * 60 * 60 * 1000 - 1 ) ).isEqualTo( "23:59 h" );
+        assertThat( CLIReportingUtils.formatDuration( 24 * 60 * 60 * 1000 ) ).isEqualTo( "1 d 00:00 h" );
     }
 }
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/CleanArgumentTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/CleanArgumentTest.java
index 7e2b489..550a280 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/CleanArgumentTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/CleanArgumentTest.java
@@ -19,33 +19,33 @@ package org.apache.maven.cli;
  * under the License.
  */
 
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
 
-import org.junit.Test;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * @author Karl Heinz Marbaise
  */
-public class CleanArgumentTest
+class CleanArgumentTest
 {
     @Test
-    public void cleanArgsShouldRemoveWrongSurroundingQuotes()
+    void cleanArgsShouldRemoveWrongSurroundingQuotes()
     {
         String[] args = { "\"-Dfoo=bar", "\"-Dfoo2=bar two\"" };
         String[] cleanArgs = CleanArgument.cleanArgs( args );
-        assertEquals( args.length, cleanArgs.length );
-        assertEquals( "-Dfoo=bar", cleanArgs[0] );
-        assertEquals( "-Dfoo2=bar two", cleanArgs[1] );
+        assertThat( cleanArgs.length ).isEqualTo( args.length );
+        assertThat( cleanArgs[0] ).isEqualTo( "-Dfoo=bar" );
+        assertThat( cleanArgs[1] ).isEqualTo( "-Dfoo2=bar two" );
     }
 
     @Test
-    public void testCleanArgsShouldNotTouchCorrectlyQuotedArgumentsUsingDoubleQuotes()
+    void testCleanArgsShouldNotTouchCorrectlyQuotedArgumentsUsingDoubleQuotes()
     {
         String information = "-Dinformation=\"The Information is important.\"";
         String[] args = { information };
         String[] cleanArgs = CleanArgument.cleanArgs( args );
-        assertEquals( args.length, cleanArgs.length );
-        assertEquals( information, cleanArgs[0] );
+        assertThat( cleanArgs.length ).isEqualTo( args.length );
+        assertThat( cleanArgs[0] ).isEqualTo( information );
     }
 
     @Test
@@ -54,8 +54,8 @@ public class CleanArgumentTest
         String information = "-Dinformation='The Information is important.'";
         String[] args = { information };
         String[] cleanArgs = CleanArgument.cleanArgs( args );
-        assertEquals( args.length, cleanArgs.length );
-        assertEquals( information, cleanArgs[0] );
+        assertThat( cleanArgs.length ).isEqualTo( args.length );
+        assertThat( cleanArgs[0] ).isEqualTo( information );
     }
 
 }
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
index 5f4c5b6..636d612 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/MavenCliTest.java
@@ -19,16 +19,6 @@ package org.apache.maven.cli;
  * under the License.
  */
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-
 import java.io.File;
 
 import org.apache.commons.cli.ParseException;
@@ -43,6 +33,10 @@ import org.junit.Before;
 import org.junit.Test;
 import org.mockito.InOrder;
 
+import static org.junit.Assert.*;
+import static org.junit.Assume.assumeTrue;
+import static org.mockito.Mockito.*;
+
 public class MavenCliTest
 {
     private MavenCli cli;
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/transfer/FileSizeFormatTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/transfer/FileSizeFormatTest.java
index e595ace..75885ce 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/transfer/FileSizeFormatTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/transfer/FileSizeFormatTest.java
@@ -23,280 +23,286 @@ import java.util.Locale;
 
 import org.apache.maven.cli.transfer.AbstractMavenTransferListener.FileSizeFormat;
 import org.apache.maven.cli.transfer.AbstractMavenTransferListener.FileSizeFormat.ScaleUnit;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
 
-public class FileSizeFormatTest {
+class FileSizeFormatTest
+{
 
-    @Test( expected = IllegalArgumentException.class )
-    public void testNegativeSize()
+    @Test
+    void testNegativeSize()
     {
         FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
 
         long negativeSize = -100L;
-        format.format( negativeSize );
+        assertThatIllegalArgumentException().isThrownBy( () -> format.format( negativeSize ) ).withMessage(
+                "file size cannot be negative: -100" );
     }
 
     @Test
-    public void testSize()
+    void testSize()
     {
         FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
 
         long _0_bytes = 0L;
-        assertEquals( "0 B", format.format( _0_bytes ) );
+        assertThat( format.format( _0_bytes ) ).isEqualTo( "0 B" );
 
         long _5_bytes = 5L;
-        assertEquals( "5 B", format.format( _5_bytes ) );
+        assertThat( format.format( _5_bytes ) ).isEqualTo( "5 B" );
 
         long _10_bytes = 10L;
-        assertEquals( "10 B", format.format( _10_bytes ) );
+        assertThat( format.format( _10_bytes ) ).isEqualTo( "10 B" );
 
         long _15_bytes = 15L;
-        assertEquals( "15 B", format.format( _15_bytes ) );
+        assertThat( format.format( _15_bytes ) ).isEqualTo( "15 B" );
 
         long _999_bytes = 999L;
-        assertEquals( "999 B", format.format( _999_bytes ) );
+        assertThat( format.format( _999_bytes ) ).isEqualTo( "999 B" );
 
         long _1000_bytes = 1000L;
-        assertEquals( "1.0 kB", format.format( _1000_bytes ) );
+        assertThat( format.format( _1000_bytes ) ).isEqualTo( "1.0 kB" );
 
         long _5500_bytes = 5500L;
-        assertEquals( "5.5 kB", format.format( _5500_bytes ) );
+        assertThat( format.format( _5500_bytes ) ).isEqualTo( "5.5 kB" );
 
         long _10_kilobytes = 10L * 1000L;
-        assertEquals( "10 kB", format.format( _10_kilobytes ) );
+        assertThat( format.format( _10_kilobytes ) ).isEqualTo( "10 kB" );
 
         long _15_kilobytes = 15L * 1000L;
-        assertEquals( "15 kB", format.format( _15_kilobytes ) );
+        assertThat( format.format( _15_kilobytes ) ).isEqualTo( "15 kB" );
 
         long _999_kilobytes = 999L * 1000L;
-        assertEquals( "999 kB", format.format( _999_kilobytes ) );
+        assertThat( format.format( _999_kilobytes ) ).isEqualTo( "999 kB" );
 
         long _1000_kilobytes = 1000L * 1000L;
-        assertEquals( "1.0 MB", format.format( _1000_kilobytes ) );
+        assertThat( format.format( _1000_kilobytes ) ).isEqualTo( "1.0 MB" );
 
         long _5500_kilobytes = 5500L * 1000L;
-        assertEquals( "5.5 MB", format.format( _5500_kilobytes ) );
+        assertThat( format.format( _5500_kilobytes ) ).isEqualTo( "5.5 MB" );
 
         long _10_megabytes = 10L * 1000L * 1000L;
-        assertEquals( "10 MB", format.format( _10_megabytes ) );
+        assertThat( format.format( _10_megabytes ) ).isEqualTo( "10 MB" );
 
         long _15_megabytes = 15L * 1000L * 1000L;
-        assertEquals( "15 MB", format.format( _15_megabytes ) );
+        assertThat( format.format( _15_megabytes ) ).isEqualTo( "15 MB" );
 
         long _999_megabytes = 999L * 1000L * 1000L;
-        assertEquals( "999 MB", format.format( _999_megabytes ) );
+        assertThat( format.format( _999_megabytes ) ).isEqualTo( "999 MB" );
 
         long _1000_megabytes = 1000L * 1000L * 1000L;
-        assertEquals( "1.0 GB", format.format( _1000_megabytes ) );
+        assertThat( format.format( _1000_megabytes ) ).isEqualTo( "1.0 GB" );
 
         long _5500_megabytes = 5500L * 1000L * 1000L;
-        assertEquals( "5.5 GB", format.format( _5500_megabytes ) );
+        assertThat( format.format( _5500_megabytes ) ).isEqualTo( "5.5 GB" );
 
         long _10_gigabytes = 10L * 1000L * 1000L * 1000L;
-        assertEquals( "10 GB", format.format( _10_gigabytes ) );
+        assertThat( format.format( _10_gigabytes ) ).isEqualTo( "10 GB" );
 
         long _15_gigabytes = 15L * 1000L * 1000L * 1000L;
-        assertEquals( "15 GB", format.format( _15_gigabytes ) );
+        assertThat( format.format( _15_gigabytes ) ).isEqualTo( "15 GB" );
 
         long _1000_gigabytes = 1000L * 1000L * 1000L * 1000L;
-        assertEquals( "1000 GB", format.format( _1000_gigabytes ) );
+        assertThat( format.format( _1000_gigabytes ) ).isEqualTo( "1000 GB" );
     }
 
     @Test
-    public void testSizeWithSelectedScaleUnit()
+    void testSizeWithSelectedScaleUnit()
     {
         FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
 
         long _0_bytes = 0L;
-        assertEquals( "0 B", format.format( _0_bytes ) );
-        assertEquals( "0 B", format.format( _0_bytes, ScaleUnit.BYTE ) );
-        assertEquals( "0 kB", format.format( _0_bytes, ScaleUnit.KILOBYTE ) );
-        assertEquals( "0 MB", format.format( _0_bytes, ScaleUnit.MEGABYTE ) );
-        assertEquals( "0 GB", format.format( _0_bytes, ScaleUnit.GIGABYTE ) );
+        assertThat( format.format( _0_bytes ) ).isEqualTo( "0 B" );
+        assertThat( format.format( _0_bytes, ScaleUnit.BYTE ) ).isEqualTo( "0 B" );
+        assertThat( format.format( _0_bytes, ScaleUnit.KILOBYTE ) ).isEqualTo( "0 kB" );
+        assertThat( format.format( _0_bytes, ScaleUnit.MEGABYTE ) ).isEqualTo( "0 MB" );
+        assertThat( format.format( _0_bytes, ScaleUnit.GIGABYTE ) ).isEqualTo( "0 GB" );
 
         long _5_bytes = 5L;
-        assertEquals( "5 B", format.format( _5_bytes ) );
-        assertEquals( "5 B", format.format( _5_bytes, ScaleUnit.BYTE ) );
-        assertEquals( "0 kB", format.format( _5_bytes, ScaleUnit.KILOBYTE ) );
-        assertEquals( "0 MB", format.format( _5_bytes, ScaleUnit.MEGABYTE ) );
-        assertEquals( "0 GB", format.format( _5_bytes, ScaleUnit.GIGABYTE ) );
+        assertThat( format.format( _5_bytes ) ).isEqualTo( "5 B" );
+        assertThat( format.format( _5_bytes, ScaleUnit.BYTE ) ).isEqualTo( "5 B" );
+        assertThat( format.format( _5_bytes, ScaleUnit.KILOBYTE ) ).isEqualTo( "0 kB" );
+        assertThat( format.format( _5_bytes, ScaleUnit.MEGABYTE ) ).isEqualTo( "0 MB" );
+        assertThat( format.format( _5_bytes, ScaleUnit.GIGABYTE ) ).isEqualTo( "0 GB" );
 
 
         long _49_bytes = 49L;
-        assertEquals( "49 B", format.format( _49_bytes ) );
-        assertEquals( "49 B", format.format( _49_bytes, ScaleUnit.BYTE ) );
-        assertEquals( "0 kB", format.format( _49_bytes, ScaleUnit.KILOBYTE ) );
-        assertEquals( "0 MB", format.format( _49_bytes, ScaleUnit.MEGABYTE ) );
-        assertEquals( "0 GB", format.format( _49_bytes, ScaleUnit.GIGABYTE ) );
+        assertThat( format.format( _49_bytes ) ).isEqualTo( "49 B" );
+        assertThat( format.format( _49_bytes, ScaleUnit.BYTE ) ).isEqualTo( "49 B" );
+        assertThat( format.format( _49_bytes, ScaleUnit.KILOBYTE ) ).isEqualTo( "0 kB" );
+        assertThat( format.format( _49_bytes, ScaleUnit.MEGABYTE ) ).isEqualTo( "0 MB" );
+        assertThat( format.format( _49_bytes, ScaleUnit.GIGABYTE ) ).isEqualTo( "0 GB" );
 
         long _50_bytes = 50L;
-        assertEquals( "50 B", format.format( _50_bytes ) );
-        assertEquals( "50 B", format.format( _50_bytes, ScaleUnit.BYTE ) );
-        assertEquals( "0.1 kB", format.format( _50_bytes, ScaleUnit.KILOBYTE ) );
-        assertEquals( "0 MB", format.format( _50_bytes, ScaleUnit.MEGABYTE ) );
-        assertEquals( "0 GB", format.format( _50_bytes, ScaleUnit.GIGABYTE ) );
+        assertThat( format.format( _50_bytes ) ).isEqualTo( "50 B" );
+        assertThat( format.format( _50_bytes, ScaleUnit.BYTE ) ).isEqualTo( "50 B" );
+        assertThat( format.format( _50_bytes, ScaleUnit.KILOBYTE ) ).isEqualTo( "0.1 kB" );
+        assertThat( format.format( _50_bytes, ScaleUnit.MEGABYTE ) ).isEqualTo( "0 MB" );
+        assertThat( format.format( _50_bytes, ScaleUnit.GIGABYTE ) ).isEqualTo( "0 GB" );
 
         long _999_bytes = 999L;
-        assertEquals( "999 B", format.format( _999_bytes ) );
-        assertEquals( "999 B", format.format( _999_bytes, ScaleUnit.BYTE ) );
-        assertEquals( "1.0 kB", format.format( _999_bytes, ScaleUnit.KILOBYTE ) );
-        assertEquals( "0 MB", format.format( _999_bytes, ScaleUnit.MEGABYTE ) );
-        assertEquals( "0 GB", format.format( _999_bytes, ScaleUnit.GIGABYTE ) );
+        assertThat( format.format( _999_bytes ) ).isEqualTo( "999 B" );
+        assertThat( format.format( _999_bytes, ScaleUnit.BYTE ) ).isEqualTo( "999 B" );
+        assertThat( format.format( _999_bytes, ScaleUnit.KILOBYTE ) ).isEqualTo( "1.0 kB" );
+        assertThat( format.format( _999_bytes, ScaleUnit.MEGABYTE ) ).isEqualTo( "0 MB" );
+        assertThat( format.format( _999_bytes, ScaleUnit.GIGABYTE ) ).isEqualTo( "0 GB" );
 
         long _1000_bytes = 1000L;
-        assertEquals( "1.0 kB", format.format( _1000_bytes ) );
-        assertEquals( "1000 B", format.format( _1000_bytes, ScaleUnit.BYTE ) );
-        assertEquals( "1.0 kB", format.format( _1000_bytes, ScaleUnit.KILOBYTE ) );
-        assertEquals( "0 MB", format.format( _1000_bytes, ScaleUnit.MEGABYTE ) );
-        assertEquals( "0 GB", format.format( _1000_bytes, ScaleUnit.GIGABYTE ) );
+        assertThat( format.format( _1000_bytes ) ).isEqualTo( "1.0 kB" );
+        assertThat( format.format( _1000_bytes, ScaleUnit.BYTE ) ).isEqualTo( "1000 B" );
+        assertThat( format.format( _1000_bytes, ScaleUnit.KILOBYTE ) ).isEqualTo( "1.0 kB" );
+        assertThat( format.format( _1000_bytes, ScaleUnit.MEGABYTE ) ).isEqualTo( "0 MB" );
+        assertThat( format.format( _1000_bytes, ScaleUnit.GIGABYTE ) ).isEqualTo( "0 GB" );
 
         long _49_kilobytes = 49L * 1000L;
-        assertEquals( "49 kB", format.format( _49_kilobytes ) );
-        assertEquals( "49000 B", format.format( _49_kilobytes, ScaleUnit.BYTE ) );
-        assertEquals( "49 kB", format.format( _49_kilobytes, ScaleUnit.KILOBYTE ) );
-        assertEquals( "0 MB", format.format( _49_kilobytes, ScaleUnit.MEGABYTE ) );
-        assertEquals( "0 GB", format.format( _49_kilobytes, ScaleUnit.GIGABYTE ) );
+        assertThat( format.format( _49_kilobytes ) ).isEqualTo( "49 kB" );
+        assertThat( format.format( _49_kilobytes, ScaleUnit.BYTE ) ).isEqualTo( "49000 B" );
+        assertThat( format.format( _49_kilobytes, ScaleUnit.KILOBYTE ) ).isEqualTo( "49 kB" );
+        assertThat( format.format( _49_kilobytes, ScaleUnit.MEGABYTE ) ).isEqualTo( "0 MB" );
+        assertThat( format.format( _49_kilobytes, ScaleUnit.GIGABYTE ) ).isEqualTo( "0 GB" );
 
         long _50_kilobytes = 50L * 1000L;
-        assertEquals( "50 kB", format.format( _50_kilobytes ) );
-        assertEquals( "50000 B", format.format( _50_kilobytes, ScaleUnit.BYTE ) );
-        assertEquals( "50 kB", format.format( _50_kilobytes, ScaleUnit.KILOBYTE ) );
-        assertEquals( "0.1 MB", format.format( _50_kilobytes, ScaleUnit.MEGABYTE ) );
-        assertEquals( "0 GB", format.format( _50_kilobytes, ScaleUnit.GIGABYTE ) );
+        assertThat( format.format( _50_kilobytes ) ).isEqualTo( "50 kB" );
+        assertThat( format.format( _50_kilobytes, ScaleUnit.BYTE ) ).isEqualTo( "50000 B" );
+        assertThat( format.format( _50_kilobytes, ScaleUnit.KILOBYTE ) ).isEqualTo( "50 kB" );
+        assertThat( format.format( _50_kilobytes, ScaleUnit.MEGABYTE ) ).isEqualTo( "0.1 MB" );
+        assertThat( format.format( _50_kilobytes, ScaleUnit.GIGABYTE ) ).isEqualTo( "0 GB" );
 
         long _999_kilobytes = 999L * 1000L;
-        assertEquals( "999 kB", format.format( _999_kilobytes ) );
-        assertEquals( "999000 B", format.format( _999_kilobytes, ScaleUnit.BYTE ) );
-        assertEquals( "999 kB", format.format( _999_kilobytes, ScaleUnit.KILOBYTE ) );
-        assertEquals( "1.0 MB", format.format( _999_kilobytes, ScaleUnit.MEGABYTE ) );
-        assertEquals( "0 GB", format.format( _999_kilobytes, ScaleUnit.GIGABYTE ) );
+        assertThat( format.format( _999_kilobytes ) ).isEqualTo( "999 kB" );
+        assertThat( format.format( _999_kilobytes, ScaleUnit.BYTE ) ).isEqualTo( "999000 B" );
+        assertThat( format.format( _999_kilobytes, ScaleUnit.KILOBYTE ) ).isEqualTo( "999 kB" );
+        assertThat( format.format( _999_kilobytes, ScaleUnit.MEGABYTE ) ).isEqualTo( "1.0 MB" );
+        assertThat( format.format( _999_kilobytes, ScaleUnit.GIGABYTE ) ).isEqualTo( "0 GB" );
 
         long _1000_kilobytes = 1000L * 1000L;
-        assertEquals( "1.0 MB", format.format( _1000_kilobytes ) );
-        assertEquals( "1000000 B", format.format( _1000_kilobytes, ScaleUnit.BYTE ) );
-        assertEquals( "1000 kB", format.format( _1000_kilobytes, ScaleUnit.KILOBYTE ) );
-        assertEquals( "1.0 MB", format.format( _1000_kilobytes, ScaleUnit.MEGABYTE ) );
-        assertEquals( "0 GB", format.format( _1000_kilobytes, ScaleUnit.GIGABYTE ) );
+        assertThat( format.format( _1000_kilobytes ) ).isEqualTo( "1.0 MB" );
+        assertThat( format.format( _1000_kilobytes, ScaleUnit.BYTE ) ).isEqualTo( "1000000 B" );
+        assertThat( format.format( _1000_kilobytes, ScaleUnit.KILOBYTE ) ).isEqualTo( "1000 kB" );
+        assertThat( format.format( _1000_kilobytes, ScaleUnit.MEGABYTE ) ).isEqualTo( "1.0 MB" );
+        assertThat( format.format( _1000_kilobytes, ScaleUnit.GIGABYTE ) ).isEqualTo( "0 GB" );
 
         long _49_megabytes = 49L * 1000L * 1000L;
-        assertEquals( "49 MB", format.format( _49_megabytes ) );
-        assertEquals( "49000000 B", format.format( _49_megabytes, ScaleUnit.BYTE ) );
-        assertEquals( "49000 kB", format.format( _49_megabytes, ScaleUnit.KILOBYTE ) );
-        assertEquals( "49 MB", format.format( _49_megabytes, ScaleUnit.MEGABYTE ) );
-        assertEquals( "0 GB", format.format( _49_megabytes, ScaleUnit.GIGABYTE ) );
+        assertThat( format.format( _49_megabytes ) ).isEqualTo( "49 MB" );
+        assertThat( format.format( _49_megabytes, ScaleUnit.BYTE ) ).isEqualTo( "49000000 B" );
+        assertThat( format.format( _49_megabytes, ScaleUnit.KILOBYTE ) ).isEqualTo( "49000 kB" );
+        assertThat( format.format( _49_megabytes, ScaleUnit.MEGABYTE ) ).isEqualTo( "49 MB" );
+        assertThat( format.format( _49_megabytes, ScaleUnit.GIGABYTE ) ).isEqualTo( "0 GB" );
 
         long _50_megabytes = 50L * 1000L * 1000L;
-        assertEquals( "50 MB", format.format( _50_megabytes ) );
-        assertEquals( "50000000 B", format.format( _50_megabytes, ScaleUnit.BYTE ) );
-        assertEquals( "50000 kB", format.format( _50_megabytes, ScaleUnit.KILOBYTE ) );
-        assertEquals( "50 MB", format.format( _50_megabytes, ScaleUnit.MEGABYTE ) );
-        assertEquals( "0.1 GB", format.format( _50_megabytes, ScaleUnit.GIGABYTE ) );
+        assertThat( format.format( _50_megabytes ) ).isEqualTo( "50 MB" );
+        assertThat( format.format( _50_megabytes, ScaleUnit.BYTE ) ).isEqualTo( "50000000 B" );
+        assertThat( format.format( _50_megabytes, ScaleUnit.KILOBYTE ) ).isEqualTo( "50000 kB" );
+        assertThat( format.format( _50_megabytes, ScaleUnit.MEGABYTE ) ).isEqualTo( "50 MB" );
+        assertThat( format.format( _50_megabytes, ScaleUnit.GIGABYTE ) ).isEqualTo( "0.1 GB" );
 
         long _999_megabytes = 999L * 1000L * 1000L;
-        assertEquals( "999 MB", format.format( _999_megabytes ) );
-        assertEquals( "999000000 B", format.format( _999_megabytes, ScaleUnit.BYTE ) );
-        assertEquals( "999000 kB", format.format( _999_megabytes, ScaleUnit.KILOBYTE ) );
-        assertEquals( "999 MB", format.format( _999_megabytes, ScaleUnit.MEGABYTE ) );
-        assertEquals( "1.0 GB", format.format( _999_megabytes, ScaleUnit.GIGABYTE ) );
+        assertThat( format.format( _999_megabytes ) ).isEqualTo( "999 MB" );
+        assertThat( format.format( _999_megabytes, ScaleUnit.BYTE ) ).isEqualTo( "999000000 B" );
+        assertThat( format.format( _999_megabytes, ScaleUnit.KILOBYTE ) ).isEqualTo( "999000 kB" );
+        assertThat( format.format( _999_megabytes, ScaleUnit.MEGABYTE ) ).isEqualTo( "999 MB" );
+        assertThat( format.format( _999_megabytes, ScaleUnit.GIGABYTE ) ).isEqualTo( "1.0 GB" );
 
         long _1000_megabytes = 1000L * 1000L * 1000L;
-        assertEquals( "1.0 GB", format.format( _1000_megabytes ) );
-        assertEquals( "1000000000 B", format.format( _1000_megabytes, ScaleUnit.BYTE ) );
-        assertEquals( "1000000 kB", format.format( _1000_megabytes, ScaleUnit.KILOBYTE ) );
-        assertEquals( "1000 MB", format.format( _1000_megabytes, ScaleUnit.MEGABYTE ) );
-        assertEquals( "1.0 GB", format.format( _1000_megabytes, ScaleUnit.GIGABYTE ) );
+        assertThat( format.format( _1000_megabytes ) ).isEqualTo( "1.0 GB" );
+        assertThat( format.format( _1000_megabytes, ScaleUnit.BYTE ) ).isEqualTo( "1000000000 B" );
+        assertThat( format.format( _1000_megabytes, ScaleUnit.KILOBYTE ) ).isEqualTo( "1000000 kB" );
+        assertThat( format.format( _1000_megabytes, ScaleUnit.MEGABYTE ) ).isEqualTo( "1000 MB" );
+        assertThat( format.format( _1000_megabytes, ScaleUnit.GIGABYTE ) ).isEqualTo( "1.0 GB" );
     }
 
-    @Test( expected = IllegalArgumentException.class )
-    public void testNegativeProgressedSize()
+    @Test
+    void testNegativeProgressedSize()
     {
         FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
 
         long negativeProgressedSize = -100L;
-        format.formatProgress( negativeProgressedSize, 10L );
+        assertThatIllegalArgumentException().isThrownBy( () -> format.formatProgress( negativeProgressedSize, 10L ) )
+                                            .withMessage( "progressed file size cannot be negative: -100" );
     }
 
-    @Test( expected = IllegalArgumentException.class )
-    public void testNegativeProgressedSizeBiggerThanSize()
+    @Test
+    void testNegativeProgressedSizeBiggerThanSize()
     {
         FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
 
-        format.formatProgress( 100L, 10L );
+        assertThatIllegalArgumentException().isThrownBy( () -> format.formatProgress( 100L, 10L ) ).withMessage(
+                "progressed file size cannot be greater than size: 100 > 10" );
     }
 
     @Test
-    public void testProgressedSizeWithoutSize()
+    void testProgressedSizeWithoutSize()
     {
-         FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
+        FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
 
-         long _0_bytes = 0L;
-         assertEquals( "0 B", format.formatProgress( _0_bytes, -1L ) );
+        long _0_bytes = 0L;
+        assertThat( format.formatProgress( _0_bytes, -1L ) ).isEqualTo( "0 B" );
 
-         long _1000_bytes = 1000L;
-         assertEquals( "1.0 kB", format.formatProgress( _1000_bytes, -1L ) );
+        long _1000_bytes = 1000L;
+        assertThat( format.formatProgress( _1000_bytes, -1L ) ).isEqualTo( "1.0 kB" );
 
-         long _1000_kilobytes = 1000L * 1000L;
-         assertEquals( "1.0 MB", format.formatProgress( _1000_kilobytes, -1L ) );
+        long _1000_kilobytes = 1000L * 1000L;
+        assertThat( format.formatProgress( _1000_kilobytes, -1L ) ).isEqualTo( "1.0 MB" );
 
-         long _1000_megabytes = 1000L * 1000L * 1000L;
-         assertEquals( "1.0 GB", format.formatProgress( _1000_megabytes, -1L ) );
+        long _1000_megabytes = 1000L * 1000L * 1000L;
+        assertThat( format.formatProgress( _1000_megabytes, -1L ) ).isEqualTo( "1.0 GB" );
 
     }
 
     @Test
-    public void testProgressedBothZero()
+    void testProgressedBothZero()
     {
-         FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
+        FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
 
-         long _0_bytes = 0L;
-         assertEquals( "0 B", format.formatProgress( _0_bytes, _0_bytes ) );
+        long _0_bytes = 0L;
+        assertThat( format.formatProgress( _0_bytes, _0_bytes ) ).isEqualTo( "0 B" );
     }
 
     @Test
-    public void testProgressedSizeWithSize()
+    void testProgressedSizeWithSize()
     {
-         FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
-
-         long _0_bytes = 0L;
-         long _400_bytes = 400L;
-         long _800_bytes = 2L * _400_bytes;
-         assertEquals( "0/800 B", format.formatProgress( _0_bytes, _800_bytes ) );
-         assertEquals( "400/800 B", format.formatProgress( _400_bytes, _800_bytes ) );
-         assertEquals( "800 B", format.formatProgress( _800_bytes, _800_bytes ) );
-
-         long _4000_bytes = 4000L;
-         long _8000_bytes = 2L * _4000_bytes;
-         long _50_kilobytes = 50000L;
-         assertEquals( "0/8.0 kB", format.formatProgress( _0_bytes, _8000_bytes ) );
-         assertEquals( "0.4/8.0 kB", format.formatProgress( _400_bytes, _8000_bytes ) );
-         assertEquals( "4.0/8.0 kB", format.formatProgress( _4000_bytes, _8000_bytes ) );
-         assertEquals( "8.0 kB", format.formatProgress( _8000_bytes, _8000_bytes ) );
-         assertEquals( "8.0/50 kB", format.formatProgress( _8000_bytes, _50_kilobytes ) );
-         assertEquals( "16/50 kB", format.formatProgress( 2L * _8000_bytes, _50_kilobytes ) );
-         assertEquals( "50 kB", format.formatProgress( _50_kilobytes, _50_kilobytes ) );
-
-         long _500_kilobytes = 500000L;
-         long _1000_kilobytes = 2L * _500_kilobytes;;
-         long _5000_kilobytes = 5L * _1000_kilobytes;
-         long _15_megabytes = 3L * _5000_kilobytes;
-         assertEquals( "0/5.0 MB", format.formatProgress( _0_bytes, _5000_kilobytes ) );
-         assertEquals( "0.5/5.0 MB", format.formatProgress( _500_kilobytes, _5000_kilobytes ) );
-         assertEquals( "1.0/5.0 MB", format.formatProgress( _1000_kilobytes, _5000_kilobytes ) );
-         assertEquals( "5.0 MB", format.formatProgress( _5000_kilobytes, _5000_kilobytes ) );
-         assertEquals( "5.0/15 MB", format.formatProgress( _5000_kilobytes, _15_megabytes ) );
-         assertEquals( "15 MB", format.formatProgress( _15_megabytes, _15_megabytes ) );
-
-         long _500_megabytes = 500000000L;
-         long _1000_megabytes = 2L * _500_megabytes;
-         long _5000_megabytes = 5L * _1000_megabytes;
-         long _15_gigabytes = 3L * _5000_megabytes;
-         assertEquals( "0/500 MB", format.formatProgress( _0_bytes, _500_megabytes ) );
-         assertEquals( "1.0/5.0 GB", format.formatProgress( _1000_megabytes, _5000_megabytes ) );
-         assertEquals( "5.0 GB", format.formatProgress( _5000_megabytes, _5000_megabytes ) );
-         assertEquals( "5.0/15 GB", format.formatProgress( _5000_megabytes, _15_gigabytes ) );
-         assertEquals( "15 GB", format.formatProgress( _15_gigabytes, _15_gigabytes ) );
+        FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
+
+        long _0_bytes = 0L;
+        long _400_bytes = 400L;
+        long _800_bytes = 2L * _400_bytes;
+        assertThat( format.formatProgress( _0_bytes, _800_bytes ) ).isEqualTo( "0/800 B" );
+        assertThat( format.formatProgress( _400_bytes, _800_bytes ) ).isEqualTo( "400/800 B" );
+        assertThat( format.formatProgress( _800_bytes, _800_bytes ) ).isEqualTo( "800 B" );
+
+        long _4000_bytes = 4000L;
+        long _8000_bytes = 2L * _4000_bytes;
+        long _50_kilobytes = 50000L;
+        assertThat( format.formatProgress( _0_bytes, _8000_bytes ) ).isEqualTo( "0/8.0 kB" );
+        assertThat( format.formatProgress( _400_bytes, _8000_bytes ) ).isEqualTo( "0.4/8.0 kB" );
+        assertThat( format.formatProgress( _4000_bytes, _8000_bytes ) ).isEqualTo( "4.0/8.0 kB" );
+        assertThat( format.formatProgress( _8000_bytes, _8000_bytes ) ).isEqualTo( "8.0 kB" );
+        assertThat( format.formatProgress( _8000_bytes, _50_kilobytes ) ).isEqualTo( "8.0/50 kB" );
+        assertThat( format.formatProgress( 2L * _8000_bytes, _50_kilobytes ) ).isEqualTo( "16/50 kB" );
+        assertThat( format.formatProgress( _50_kilobytes, _50_kilobytes ) ).isEqualTo( "50 kB" );
+
+        long _500_kilobytes = 500000L;
+        long _1000_kilobytes = 2L * _500_kilobytes;
+        ;
+        long _5000_kilobytes = 5L * _1000_kilobytes;
+        long _15_megabytes = 3L * _5000_kilobytes;
+        assertThat( format.formatProgress( _0_bytes, _5000_kilobytes ) ).isEqualTo( "0/5.0 MB" );
+        assertThat( format.formatProgress( _500_kilobytes, _5000_kilobytes ) ).isEqualTo( "0.5/5.0 MB" );
+        assertThat( format.formatProgress( _1000_kilobytes, _5000_kilobytes ) ).isEqualTo( "1.0/5.0 MB" );
+        assertThat( format.formatProgress( _5000_kilobytes, _5000_kilobytes ) ).isEqualTo( "5.0 MB" );
+        assertThat( format.formatProgress( _5000_kilobytes, _15_megabytes ) ).isEqualTo( "5.0/15 MB" );
+        assertThat( format.formatProgress( _15_megabytes, _15_megabytes ) ).isEqualTo( "15 MB" );
+
+        long _500_megabytes = 500000000L;
+        long _1000_megabytes = 2L * _500_megabytes;
+        long _5000_megabytes = 5L * _1000_megabytes;
+        long _15_gigabytes = 3L * _5000_megabytes;
+        assertThat( format.formatProgress( _0_bytes, _500_megabytes ) ).isEqualTo( "0/500 MB" );
+        assertThat( format.formatProgress( _1000_megabytes, _5000_megabytes ) ).isEqualTo( "1.0/5.0 GB" );
+        assertThat( format.formatProgress( _5000_megabytes, _5000_megabytes ) ).isEqualTo( "5.0 GB" );
+        assertThat( format.formatProgress( _5000_megabytes, _15_gigabytes ) ).isEqualTo( "5.0/15 GB" );
+        assertThat( format.formatProgress( _15_gigabytes, _15_gigabytes ) ).isEqualTo( "15 GB" );
     }
 
 }
\ No newline at end of file
diff --git a/maven-model-builder/pom.xml b/maven-model-builder/pom.xml
index a2145d2..36e76ff 100644
--- a/maven-model-builder/pom.xml
+++ b/maven-model-builder/pom.xml
@@ -89,6 +89,16 @@ under the License.
       <artifactId>powermock-reflect</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.assertj</groupId>
+      <artifactId>assertj-core</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java
index 9b0ecd9..b694bf1 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java
@@ -18,51 +18,49 @@ package org.apache.maven.model.building;
  * specific language governing permissions and limitations
  * under the License.
  */
+
 import java.io.File;
 import java.io.IOException;
-import static junit.framework.TestCase.assertFalse;
-import static junit.framework.TestCase.assertTrue;
-import org.apache.commons.lang3.SystemUtils;
-import static org.junit.Assume.assumeTrue;
-import org.junit.Test;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledOnOs;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.condition.OS.WINDOWS;
 
 /**
  * Test that validate the solution of MNG-6261 issue
- *
  */
-public class FileModelSourceTest
+class FileModelSourceTest
 {
 
     /**
      * Test of equals method, of class FileModelSource.
      */
     @Test
-    public void testEquals()
-            throws Exception 
+    void testEquals() throws Exception
     {
         File tempFile = createTempFile( "pomTest" );
         FileModelSource instance = new FileModelSource( tempFile );
 
-        assertFalse( instance.equals( null ) );
-        assertFalse( instance.equals( new Object() ) );
-        assertTrue( instance.equals( instance ) );
-        assertTrue( instance.equals( new FileModelSource( tempFile ) ) );
+        assertThat(instance.equals( null )).isFalse();
+        assertThat( instance.equals( new Object() ) ).isFalse();
+        assertThat( instance.equals( instance ) ).isTrue();
+        assertThat( instance.equals( new FileModelSource( tempFile ) ) ).isTrue();
     }
 
     @Test
-    public void testWindowsPaths() 
-            throws Exception 
+    @EnabledOnOs( WINDOWS )
+    void testWindowsPaths() throws Exception
     {
-        assumeTrue( SystemUtils.IS_OS_WINDOWS );
-
         File upperCaseFile = createTempFile( "TESTE" );
         String absolutePath = upperCaseFile.getAbsolutePath();
         File lowerCaseFile = new File( absolutePath.toLowerCase() );
-        
+
         FileModelSource upperCaseFileSouce = new FileModelSource( upperCaseFile );
         FileModelSource lowerCaseFileSouce = new FileModelSource( lowerCaseFile );
 
-        assertTrue( upperCaseFileSouce.equals( lowerCaseFileSouce ) );        
+        assertThat( upperCaseFileSouce.equals( lowerCaseFileSouce ) ).isTrue();
     }
 
     private File createTempFile( String name ) throws IOException
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/MavenBuildTimestampTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/MavenBuildTimestampTest.java
index 8af32fc..3067753 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/MavenBuildTimestampTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/MavenBuildTimestampTest.java
@@ -22,17 +22,20 @@ package org.apache.maven.model.interpolation;
 import java.util.Date;
 import java.util.Properties;
 
-import junit.framework.TestCase;
+import org.junit.jupiter.api.Test;
 
-public class MavenBuildTimestampTest
-    extends TestCase
+import static org.assertj.core.api.Assertions.assertThat;
+
+class MavenBuildTimestampTest
 {
-    public void testMavenBuildTimestampUsesUTC()
+    @Test
+    void testMavenBuildTimestampUsesUTC()
     {
         Properties interpolationProperties = new Properties();
         interpolationProperties.setProperty( "maven.build.timestamp.format", "yyyyMMdd'T'HHmm'Z'" );
         MavenBuildTimestamp timestamp = new MavenBuildTimestamp( new Date(), interpolationProperties );
         String formattedTimestamp = timestamp.formattedTimestamp();
-        assertTrue( "We expect the UTC marker at the end of the timestamp.", formattedTimestamp.endsWith( "Z" ) );
+        assertThat( formattedTimestamp ).describedAs( "We expect the UTC marker at the end of the timestamp." )
+                                        .endsWith( "Z" );
     }
 }
diff --git a/maven-utils/pom.xml b/maven-utils/pom.xml
index 0472794..36a5710 100644
--- a/maven-utils/pom.xml
+++ b/maven-utils/pom.xml
@@ -37,19 +37,15 @@ under the License.
     <dependency>
       <groupId>org.apiguardian</groupId>
       <artifactId>apiguardian-api</artifactId>
-      <version>1.1.0</version>
     </dependency>
-
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter-engine</artifactId>
       <scope>test</scope>
-      <version>5.5.2</version>
     </dependency>
     <dependency>
       <groupId>org.assertj</groupId>
       <artifactId>assertj-core</artifactId>
-      <version>3.14.0</version>
       <scope>test</scope>
     </dependency>
 
diff --git a/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java b/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
index 677d3fb..258e5a2 100644
--- a/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
+++ b/maven-utils/src/main/java/org/apache/maven/utils/Precondition.java
@@ -37,24 +37,6 @@ public final class Precondition
     {
         // no-op
     }
-/*
-    int c = str != null && str.length() > 0 ? str.charAt( 0 ) : 0;
-        if ( ( c < '0' || c > '9' ) && ( c < 'a' || c > 'z' ) )
-    {
-        Validate.notBlank( str, message );
-    }
-*/
-    public static boolean notBlank(String str, String message)
-    {
-        for ( int i = 0; i < str.length(); i++ )
-        {
-            if ( !Character.isWhitespace( str.charAt( i ) ) )
-            {
-                return false;
-            }
-        }
-        throw new IllegalArgumentException( message );
-    }
 
     /**
      * assert that the given {@code obj} is not {@code null}.
@@ -101,6 +83,20 @@ public final class Precondition
             throw new IllegalArgumentException( message );
         }
 
+        if ( longValue < 0 )
+        {
+            throw new IllegalArgumentException( message );
+        }
+        return longValue;
+    }
+
+    public static Long requireGreaterOrEqualZero(Long longValue, String message)
+    {
+        if ( longValue == null )
+        {
+            throw new IllegalArgumentException( message );
+        }
+
         if ( longValue <= 0 )
         {
             throw new IllegalArgumentException( message );
@@ -124,6 +120,19 @@ public final class Precondition
         }
     }
 
+    public static Long greaterOrEqualToZero(Long currentValue, String message, final long value) {
+        if ( currentValue == null )
+        {
+            throw new IllegalArgumentException( String.format( message, value ) );
+        }
+
+        if ( currentValue < 0 )
+        {
+            throw new IllegalArgumentException( String.format( message, value ) );
+        }
+        return currentValue;
+    }
+
     public static Long requireGreaterThanZero(Long longValue, String message, final long value) {
         if ( longValue == null )
         {
@@ -199,6 +208,19 @@ public final class Precondition
         return true;
     }
 
+    public static boolean notBlank(String str, String message)
+    {
+        for ( int i = 0; i < str.length(); i++ )
+        {
+            if ( !Character.isWhitespace( str.charAt( i ) ) )
+            {
+                return false;
+            }
+        }
+        throw new IllegalArgumentException( message );
+    }
+
+
     public static boolean isBlank(String str, String message)
     {
         if ( str == null || str.trim().isEmpty() )
@@ -212,6 +234,23 @@ public final class Precondition
         return cs == null || cs.length() == 0;
     }
 
+    public static boolean isDigits(final String str) {
+        return isNumeric(str);
+    }
+
+    public static boolean isNumeric(final CharSequence cs) {
+        if (isEmpty(cs)) {
+            return false;
+        }
+        final int sz = cs.length();
+        for (int i = 0; i < sz; i++) {
+            if (!Character.isDigit(cs.charAt(i))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
 
 }
 
diff --git a/maven-utils/src/test/java/org/apache/maven/utils/PreconditionTest.java b/maven-utils/src/test/java/org/apache/maven/utils/PreconditionTest.java
index 5a157b3..18811c5 100644
--- a/maven-utils/src/test/java/org/apache/maven/utils/PreconditionTest.java
+++ b/maven-utils/src/test/java/org/apache/maven/utils/PreconditionTest.java
@@ -22,14 +22,13 @@ package org.apache.maven.utils;
 import org.junit.jupiter.api.Test;
 
 import static org.apache.maven.utils.Precondition.notBlank;
-import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
+import static org.assertj.core.api.Assertions.assertThatCode;
 
 class PreconditionTest
 {
     @Test
     void first()
     {
-        assertThatIllegalArgumentException()
-                .isThrownBy( () -> notBlank( "x", "Message" ) );
+        assertThatCode( () -> notBlank( "x", "Message" ) ).doesNotThrowAnyException();
     }
 }
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 7f13b06..582cb2e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -430,6 +430,23 @@ under the License.
         <version>1.3</version>
         <scope>test</scope>
       </dependency>
+      <dependency>
+        <groupId>org.assertj</groupId>
+        <artifactId>assertj-core</artifactId>
+        <version>3.14.0</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apiguardian</groupId>
+        <artifactId>apiguardian-api</artifactId>
+        <version>1.1.0</version>
+      </dependency>
+      <dependency>
+        <groupId>org.junit</groupId>
+        <artifactId>junit-bom</artifactId>
+        <version>5.6.0-M1</version>
+        <scope>import</scope>
+        <type>pom</type>
+      </dependency>
     </dependencies>
     <!--bootstrap-start-comment-->
   </dependencyManagement>