maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slachiew...@apache.org
Subject [maven] 03/03: [MNG-6481] Remove usage of lang3.JavaVersion for check Java version in tests
Date Sun, 14 Oct 2018 22:04:15 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 8d0879521b89092366c7c5149da69e07dd38789b
Author: Sylwester Lachiewicz <slachiewicz@apache.org>
AuthorDate: Mon Oct 15 00:00:07 2018 +0200

    [MNG-6481] Remove usage of lang3.JavaVersion for check Java version in tests
    
    Assume that we run with Java 7 or above
---
 .../org/apache/maven/cli/transfer/FileSizeFormatTest.java   | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

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 a870411..6d64bc5 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
@@ -21,8 +21,6 @@ package org.apache.maven.cli.transfer;
 
 import java.util.Locale;
 
-import org.apache.commons.lang3.JavaVersion;
-import org.apache.commons.lang3.SystemUtils;
 import org.apache.maven.cli.transfer.AbstractMavenTransferListener.FileSizeFormat;
 import org.apache.maven.cli.transfer.AbstractMavenTransferListener.FileSizeFormat.ScaleUnit;
 
@@ -31,6 +29,11 @@ import org.junit.Test;
 
 public class FileSizeFormatTest {
 
+    private boolean isJava7()
+    {
+        return System.getProperty( "java.version" ).startsWith( "1.7" );
+    }
+
     @Test( expected = IllegalArgumentException.class )
     public void testNegativeSize()
     {
@@ -136,7 +139,7 @@ public class FileSizeFormatTest {
         long _50_bytes = 50L;
         assertEquals( "50 B", format.format( _50_bytes ) );
         assertEquals( "50 B", format.format( _50_bytes, ScaleUnit.BYTE ) );
-        if ( SystemUtils.isJavaVersionAtLeast( JavaVersion.JAVA_1_8 ) )
+        if ( !isJava7() )
         {
             assertEquals( "0.1 kB", format.format( _50_bytes, ScaleUnit.KILOBYTE ) );
         }
@@ -168,7 +171,7 @@ public class FileSizeFormatTest {
         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 ) );
-        if ( SystemUtils.isJavaVersionAtLeast( JavaVersion.JAVA_1_8 ) )
+        if ( !isJava7() )
         {
             assertEquals( "0.1 MB", format.format( _50_kilobytes, ScaleUnit.MEGABYTE ) );
         }
@@ -200,7 +203,7 @@ public class FileSizeFormatTest {
         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 ) );
-        if ( SystemUtils.isJavaVersionAtLeast( JavaVersion.JAVA_1_8 ) )
+        if ( !isJava7() )
         {
             assertEquals( "0.1 GB", format.format( _50_megabytes, ScaleUnit.GIGABYTE ) );
         }


Mime
View raw message