You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2012/10/28 18:43:43 UTC

svn commit: r1403052 - /maven/plugins/trunk/maven-invoker-plugin/src/test/java/org/apache/maven/plugin/invoker/SelectorUtilsTest.java

Author: rfscholte
Date: Sun Oct 28 17:43:43 2012
New Revision: 1403052

URL: http://svn.apache.org/viewvc?rev=1403052&view=rev
Log:
Use Arrays.asList with varArgs support instead of private method

Modified:
    maven/plugins/trunk/maven-invoker-plugin/src/test/java/org/apache/maven/plugin/invoker/SelectorUtilsTest.java

Modified: maven/plugins/trunk/maven-invoker-plugin/src/test/java/org/apache/maven/plugin/invoker/SelectorUtilsTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/test/java/org/apache/maven/plugin/invoker/SelectorUtilsTest.java?rev=1403052&r1=1403051&r2=1403052&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/test/java/org/apache/maven/plugin/invoker/SelectorUtilsTest.java (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/test/java/org/apache/maven/plugin/invoker/SelectorUtilsTest.java Sun Oct 28 17:43:43 2012
@@ -34,18 +34,6 @@ public class SelectorUtilsTest
     extends TestCase
 {
 
-    private List<Integer> list( int[] numbers )
-    {
-        List<Integer> result = new ArrayList<Integer>();
-
-        for ( int i = 0; i < numbers.length; i++ )
-        {
-            result.add( new Integer( numbers[i] ) );
-        }
-
-        return result;
-    }
-
     public void testParseList()
     {
         List<String> includes = new ArrayList<String>();
@@ -54,48 +42,49 @@ public class SelectorUtilsTest
         SelectorUtils.parseList( null, includes, excludes );
 
         SelectorUtils.parseList( " 1.5, !1.4, 1.6+ ", includes, excludes );
-        assertEquals( Arrays.asList( new String[] { "1.5", "1.6+" } ), includes );
-        assertEquals( Arrays.asList( new String[] { "1.4" } ), excludes );
+        assertEquals( Arrays.asList( "1.5", "1.6+" ), includes );
+        assertEquals( Arrays.asList( "1.4" ), excludes );
     }
 
     public void testParseVersion()
     {
-        assertEquals( list( new int[] { 1, 6, 0, 12 } ), SelectorUtils.parseVersion( "1.6.0_12" ) );
+        assertEquals( Arrays.asList( 1, 6, 0, 12 ), SelectorUtils.parseVersion( "1.6.0_12" ) );
 
-        assertEquals( list( new int[] { 1, 6, 0, 12 } ), SelectorUtils.parseVersion( "1.6.0_12+" ) );
-        assertEquals( list( new int[] { 1, 6, 0, 12 } ), SelectorUtils.parseVersion( "1.6.0_12-" ) );
+        assertEquals( Arrays.asList( 1, 6, 0, 12 ), SelectorUtils.parseVersion( "1.6.0_12+" ) );
+        assertEquals( Arrays.asList( 1, 6, 0, 12 ), SelectorUtils.parseVersion( "1.6.0_12-" ) );
     }
 
     public void testCompareVersions()
     {
-        assertTrue( SelectorUtils.compareVersions( list( new int[] { 1, 6 } ), list( new int[] { 1, 6 } ) ) == 0 );
+        assertTrue( SelectorUtils.compareVersions( Arrays.asList( 1, 6 ), Arrays.asList( 1, 6 ) ) == 0 );
 
-        assertTrue( SelectorUtils.compareVersions( list( new int[] { 1, 5 } ), list( new int[] { 1, 6 } ) ) < 0 );
-        assertTrue( SelectorUtils.compareVersions( list( new int[] { 1, 6 } ), list( new int[] { 1, 5 } ) ) > 0 );
+        assertTrue( SelectorUtils.compareVersions( Arrays.asList( 1, 5 ), Arrays.asList( 1, 6 ) ) < 0 );
+        assertTrue( SelectorUtils.compareVersions( Arrays.asList( 1, 6 ), Arrays.asList( 1, 5 ) ) > 0 );
 
-        assertTrue( SelectorUtils.compareVersions( list( new int[] { 1 } ), list( new int[] { 1, 6 } ) ) < 0 );
-        assertTrue( SelectorUtils.compareVersions( list( new int[] { 1, 6 } ), list( new int[] { 1 } ) ) > 0 );
+        assertTrue( SelectorUtils.compareVersions( Arrays.asList( 1 ), Arrays.asList( 1, 6 ) ) < 0 );
+        assertTrue( SelectorUtils.compareVersions( Arrays.asList( 1, 6 ), Arrays.asList( 1 ) ) > 0 );
     }
 
     public void testIsMatchingJre()
     {
-        assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 4, 2, 8 } ), "1.5" ) );
-        assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 5 } ), "1.5" ) );
-        assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 5, 9 } ), "1.5" ) );
-        assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 6 } ), "1.5" ) );
-
-        assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 4, 2, 8 } ), "1.5+" ) );
-        assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 5 } ), "1.5+" ) );
-        assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 5, 9 } ), "1.5+" ) );
-        assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 6 } ), "1.5+" ) );
-
-        assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 4, 2, 8 } ), "1.5-" ) );
-        assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 5 } ), "1.5-" ) );
-        assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 5, 9 } ), "1.5-" ) );
-        assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 6 } ), "1.5-" ) );
 
-        assertTrue( SelectorUtils.isJreVersion( (String) null , "1.5" ) );
-        assertTrue( SelectorUtils.isJreVersion( "" , "1.5" ) );
+        assertFalse( SelectorUtils.isJreVersion( Arrays.asList( 1, 4, 2, 8 ), "1.5" ) );
+        assertTrue( SelectorUtils.isJreVersion( Arrays.asList( 1, 5 ), "1.5" ) );
+        assertTrue( SelectorUtils.isJreVersion( Arrays.asList( 1, 5, 9 ), "1.5" ) );
+        assertFalse( SelectorUtils.isJreVersion( Arrays.asList( 1, 6 ), "1.5" ) );
+
+        assertFalse( SelectorUtils.isJreVersion( Arrays.asList( 1, 4, 2, 8 ), "1.5+" ) );
+        assertTrue( SelectorUtils.isJreVersion( Arrays.asList( 1, 5 ), "1.5+" ) );
+        assertTrue( SelectorUtils.isJreVersion( Arrays.asList( 1, 5, 9 ), "1.5+" ) );
+        assertTrue( SelectorUtils.isJreVersion( Arrays.asList( 1, 6 ), "1.5+" ) );
+
+        assertTrue( SelectorUtils.isJreVersion( Arrays.asList( 1, 4, 2, 8 ), "1.5-" ) );
+        assertFalse( SelectorUtils.isJreVersion( Arrays.asList( 1, 5 ), "1.5-" ) );
+        assertFalse( SelectorUtils.isJreVersion( Arrays.asList( 1, 5, 9 ), "1.5-" ) );
+        assertFalse( SelectorUtils.isJreVersion( Arrays.asList( 1, 6 ), "1.5-" ) );
+
+        assertTrue( SelectorUtils.isJreVersion( (String) null, "1.5" ) );
+        assertTrue( SelectorUtils.isJreVersion( "", "1.5" ) );
     }
 
 }