You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mc...@apache.org on 2012/01/12 10:35:53 UTC
svn commit: r1230454 - in
/commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test:
ArrayCreationTest.java ArrayElementsTest.java
enhance/TestExpressionCompiler.java
Author: mcucchiara
Date: Thu Jan 12 09:35:53 2012
New Revision: 1230454
URL: http://svn.apache.org/viewvc?rev=1230454&view=rev
Log:
Removed boxing, used for each loop,
Modified:
commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayCreationTest.java
commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayElementsTest.java
commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/enhance/TestExpressionCompiler.java
Modified: commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayCreationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayCreationTest.java?rev=1230454&r1=1230453&r2=1230454&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayCreationTest.java (original)
+++ commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayCreationTest.java Thu Jan 12 09:35:53 2012
@@ -43,7 +43,7 @@ public class ArrayCreationTest
{ ROOT, "new String[] { \"one\", \"two\" }", new String[] { "one", "two" } },
{ ROOT, "new String[] { 1, 2 }", new String[] { "1", "2" } },
{ ROOT, "new Integer[] { \"1\", 2, \"3\" }",
- new Integer[] { new Integer( 1 ), new Integer( 2 ), new Integer( 3 ) } },
+ new Integer[] { 1, 2, 3 } },
{ ROOT, "new String[10]", new String[10] },
{ ROOT, "new Object[4] { #root, #this }", ExpressionSyntaxException.class },
{ ROOT, "new Object[4]", new Object[4] },
@@ -69,28 +69,28 @@ public class ArrayCreationTest
public static Collection<Object[]> data()
{
Collection<Object[]> data = new ArrayList<Object[]>(TESTS.length);
- for ( int i = 0; i < TESTS.length; i++ )
+ for ( Object[] TEST : TESTS )
{
Object[] tmp = new Object[6];
- tmp[0] = TESTS[i][1];
- tmp[1] = TESTS[i][0];
- tmp[2] = TESTS[i][1];
+ tmp[0] = TEST[1];
+ tmp[1] = TEST[0];
+ tmp[2] = TEST[1];
- switch ( TESTS[i].length )
+ switch ( TEST.length )
{
case 3:
- tmp[3] = TESTS[i][2];
+ tmp[3] = TEST[2];
break;
case 4:
- tmp[3] = TESTS[i][2];
- tmp[4] = TESTS[i][3];
+ tmp[3] = TEST[2];
+ tmp[4] = TEST[3];
break;
case 5:
- tmp[3] = TESTS[i][2];
- tmp[4] = TESTS[i][3];
- tmp[5] = TESTS[i][4];
+ tmp[3] = TEST[2];
+ tmp[4] = TEST[3];
+ tmp[5] = TEST[4];
break;
default:
Modified: commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayElementsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayElementsTest.java?rev=1230454&r1=1230453&r2=1230454&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayElementsTest.java (original)
+++ commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayElementsTest.java Thu Jan 12 09:35:53 2012
@@ -42,18 +42,18 @@ public class ArrayElementsTest
private static Object[][] TESTS = {
// Array elements test
- { STRING_ARRAY, "length", new Integer( 2 ) },
+ { STRING_ARRAY, "length", 2 },
{ STRING_ARRAY, "#root[1]", "world" },
- { INT_ARRAY, "#root[1]", new Integer( 20 ) },
- { INT_ARRAY, "#root[1]", new Integer( 20 ), "50", new Integer( 50 ) },
- { INT_ARRAY, "#root[1]", new Integer( 50 ), new String[] { "50", "100" }, new Integer( 50 ) },
- { ROOT, "intValue", new Integer( 0 ), new String[] { "50", "100" }, new Integer( 50 ) },
+ { INT_ARRAY, "#root[1]", 20 },
+ { INT_ARRAY, "#root[1]", 20, "50", 50 },
+ { INT_ARRAY, "#root[1]", 50, new String[] { "50", "100" }, 50 },
+ { ROOT, "intValue", 0, new String[] { "50", "100" }, 50 },
{ ROOT, "array", ROOT.getArray(), new String[] { "50", "100" }, new int[] { 50, 100 } },
- { null, "\"{Hello}\".toCharArray()[6]", new Character( '}' ) },
- { null, "\"Tapestry\".toCharArray()[2]", new Character( 'p' ) },
+ { null, "\"{Hello}\".toCharArray()[6]", '}' },
+ { null, "\"Tapestry\".toCharArray()[2]", 'p' },
{ null, "{'1','2','3'}",
- Arrays.asList( new Object[] { new Character( '1' ), new Character( '2' ), new Character( '3' ) } ) },
- { null, "{ true, !false }", Arrays.asList( new Boolean[] { Boolean.TRUE, Boolean.TRUE } ) } };
+ Arrays.asList( '1', '2', '3' ) },
+ { null, "{ true, !false }", Arrays.asList( Boolean.TRUE, Boolean.TRUE ) } };
/*
* =================================================================== Private static methods
@@ -67,28 +67,28 @@ public class ArrayElementsTest
public static Collection<Object[]> data()
{
Collection<Object[]> data = new ArrayList<Object[]>(TESTS.length);
- for ( int i = 0; i < TESTS.length; i++ )
+ for ( Object[] TEST : TESTS )
{
Object[] tmp = new Object[6];
- tmp[0] = TESTS[i][1];
- tmp[1] = TESTS[i][0];
- tmp[2] = TESTS[i][1];
+ tmp[0] = TEST[1];
+ tmp[1] = TEST[0];
+ tmp[2] = TEST[1];
- switch ( TESTS[i].length )
+ switch ( TEST.length )
{
case 3:
- tmp[3] = TESTS[i][2];
+ tmp[3] = TEST[2];
break;
case 4:
- tmp[3] = TESTS[i][2];
- tmp[4] = TESTS[i][3];
+ tmp[3] = TEST[2];
+ tmp[4] = TEST[3];
break;
case 5:
- tmp[3] = TESTS[i][2];
- tmp[4] = TESTS[i][3];
- tmp[5] = TESTS[i][4];
+ tmp[3] = TEST[2];
+ tmp[4] = TEST[3];
+ tmp[5] = TEST[4];
break;
default:
Modified: commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/enhance/TestExpressionCompiler.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/enhance/TestExpressionCompiler.java?rev=1230454&r1=1230453&r2=1230454&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/enhance/TestExpressionCompiler.java (original)
+++ commons/proper/ognl/trunk/src/test/java/org/apache/commons/ognl/test/enhance/TestExpressionCompiler.java Thu Jan 12 09:35:53 2012
@@ -199,7 +199,7 @@ public class TestExpressionCompiler
public void test_Indexed_Property()
throws Throwable
{
- Map map = new HashMap();
+ Map<String,String> map = new HashMap<String,String>();
map.put( "key", "value" );
Node expression = Ognl.compileExpression( _context, this, "key" );