diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionWithConversionTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionWithConversionTests.java index d8e871e3c9..c4b1df90bc 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionWithConversionTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ExpressionWithConversionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,14 +75,14 @@ public class ExpressionWithConversionTests extends AbstractExpressionTests { // ArrayList containing List to List Class clazz = typeDescriptorForListOfString.getElementTypeDescriptor().getType(); assertEquals(String.class,clazz); - List l = (List) tcs.convertValue(listOfInteger, TypeDescriptor.forObject(listOfInteger), typeDescriptorForListOfString); + List l = (List) tcs.convertValue(listOfInteger, TypeDescriptor.forObject(listOfInteger), typeDescriptorForListOfString); assertNotNull(l); // ArrayList containing List to List clazz = typeDescriptorForListOfInteger.getElementTypeDescriptor().getType(); assertEquals(Integer.class,clazz); - l = (List) tcs.convertValue(listOfString, TypeDescriptor.forObject(listOfString), typeDescriptorForListOfString); + l = (List) tcs.convertValue(listOfString, TypeDescriptor.forObject(listOfString), typeDescriptorForListOfString); assertNotNull(l); } @@ -95,7 +95,7 @@ public class ExpressionWithConversionTests extends AbstractExpressionTests { // Assign a List to the List field - the component elements should be converted parser.parseExpression("listOfInteger").setValue(context,listOfString); assertEquals(3,e.getValue(context,Integer.class).intValue()); // size now 3 - Class clazz = parser.parseExpression("listOfInteger[1].getClass()").getValue(context,Class.class); // element type correctly Integer + Class clazz = parser.parseExpression("listOfInteger[1].getClass()").getValue(context, Class.class); // element type correctly Integer assertEquals(Integer.class,clazz); } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/IndexingTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/IndexingTests.java index aebe158468..9758a93977 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/IndexingTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/IndexingTests.java @@ -1,3 +1,19 @@ +/* + * Copyright 2002-2014 the original author or authors. + * + * Licensed 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. + */ + package org.springframework.expression.spel; import static org.junit.Assert.assertEquals; @@ -64,12 +80,12 @@ public class IndexingTests { @Override public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { - return (((Map) target).containsKey(name)); + return (((Map) target).containsKey(name)); } @Override public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { - return new TypedValue(((Map) target).get(name)); + return new TypedValue(((Map) target).get(name)); } @Override @@ -298,7 +314,7 @@ public class IndexingTests { @Test public void resolveCollectionElementType() { - listNotGeneric = new ArrayList(); + listNotGeneric = new ArrayList(2); listNotGeneric.add(5); listNotGeneric.add(6); SpelExpressionParser parser = new SpelExpressionParser(); @@ -338,7 +354,7 @@ public class IndexingTests { @Test public void testListOfScalar() { - listOfScalarNotGeneric = new ArrayList(); + listOfScalarNotGeneric = new ArrayList(1); listOfScalarNotGeneric.add("5"); SpelExpressionParser parser = new SpelExpressionParser(); Expression expression = parser.parseExpression("listOfScalarNotGeneric[0]"); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java index ae65b1983d..60b3550177 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/MapAccessTests.java @@ -182,12 +182,12 @@ public class MapAccessTests extends AbstractExpressionTests { @Override public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { - return (((Map) target).containsKey(name)); + return (((Map) target).containsKey(name)); } @Override public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { - return new TypedValue(((Map) target).get(name)); + return new TypedValue(((Map) target).get(name)); } @Override diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SelectionAndProjectionTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SelectionAndProjectionTests.java index 30f68a4053..f3c1bb5bc2 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SelectionAndProjectionTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SelectionAndProjectionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ public class SelectionAndProjectionTests { EvaluationContext context = new StandardEvaluationContext(new ListTestBean()); Object value = expression.getValue(context); assertTrue(value instanceof List); - List list = (List) value; + List list = (List) value; assertEquals(5, list.size()); assertEquals(0, list.get(0)); assertEquals(1, list.get(1)); @@ -79,7 +79,7 @@ public class SelectionAndProjectionTests { EvaluationContext context = new StandardEvaluationContext(new SetTestBean()); Object value = expression.getValue(context); assertTrue(value instanceof List); - List list = (List) value; + List list = (List) value; assertEquals(5, list.size()); assertEquals(0, list.get(0)); assertEquals(1, list.get(1)); @@ -221,7 +221,7 @@ public class SelectionAndProjectionTests { context.setVariable("testList", IntegerTestBean.createList()); Object value = expression.getValue(context); assertTrue(value instanceof List); - List list = (List) value; + List list = (List) value; assertEquals(3, list.size()); assertEquals(5, list.get(0)); assertEquals(6, list.get(1)); @@ -235,7 +235,7 @@ public class SelectionAndProjectionTests { context.setVariable("testList", IntegerTestBean.createSet()); Object value = expression.getValue(context); assertTrue(value instanceof List); - List list = (List) value; + List list = (List) value; assertEquals(3, list.size()); assertEquals(5, list.get(0)); assertEquals(6, list.get(1)); diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java index 30d71941b9..45402fc63e 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SetValueTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -166,15 +166,15 @@ public class SetValueTests extends AbstractExpressionTests { e.setValue(eContext, "true"); // All keys should be strings - Set ks = parse("mapOfStringToBoolean.keySet()").getValue(eContext,Set.class); + Set ks = parse("mapOfStringToBoolean.keySet()").getValue(eContext, Set.class); for (Object o: ks) { assertEquals(String.class,o.getClass()); } // All values should be booleans - Collection vs = parse("mapOfStringToBoolean.values()").getValue(eContext,Collection.class); + Collection vs = parse("mapOfStringToBoolean.values()").getValue(eContext, Collection.class); for (Object o: vs) { - assertEquals(Boolean.class,o.getClass()); + assertEquals(Boolean.class, o.getClass()); } // One final test check coercion on the key for a map lookup diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java index 002fef3a96..02b92f6b9b 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SpelDocumentationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -383,8 +383,8 @@ public class SpelDocumentationTests extends AbstractExpressionTests { @Test public void testTypes() throws Exception { - Class dateClass = parser.parseExpression("T(java.util.Date)").getValue(Class.class); - assertEquals(Date.class,dateClass); + Class dateClass = parser.parseExpression("T(java.util.Date)").getValue(Class.class); + assertEquals(Date.class, dateClass); boolean trueValue = parser.parseExpression("T(java.math.RoundingMode).CEILING < T(java.math.RoundingMode).FLOOR").getValue(Boolean.class); assertTrue(trueValue); } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java index 32447dda91..a4ef723a8f 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -481,7 +481,7 @@ public class ReflectionHelperTests extends AbstractExpressionTests { /** * Used to validate the match returned from a compareArguments call. */ - private void checkMatch(Class[] inputTypes, Class[] expectedTypes, StandardTypeConverter typeConverter, ArgumentsMatchKind expectedMatchKind) { + private void checkMatch(Class[] inputTypes, Class[] expectedTypes, StandardTypeConverter typeConverter, ArgumentsMatchKind expectedMatchKind) { ReflectionHelper.ArgumentsMatchInfo matchInfo = ReflectionHelper.compareArguments(getTypeDescriptors(expectedTypes), getTypeDescriptors(inputTypes), typeConverter); if (expectedMatchKind == null) { assertNull("Did not expect them to match in any way", matchInfo); @@ -504,7 +504,7 @@ public class ReflectionHelperTests extends AbstractExpressionTests { /** * Used to validate the match returned from a compareArguments call. */ - private void checkMatch2(Class[] inputTypes, Class[] expectedTypes, StandardTypeConverter typeConverter, ArgumentsMatchKind expectedMatchKind) { + private void checkMatch2(Class[] inputTypes, Class[] expectedTypes, StandardTypeConverter typeConverter, ArgumentsMatchKind expectedMatchKind) { ReflectionHelper.ArgumentsMatchInfo matchInfo = ReflectionHelper.compareArgumentsVarargs(getTypeDescriptors(expectedTypes), getTypeDescriptors(inputTypes), typeConverter); if (expectedMatchKind == null) { assertNull("Did not expect them to match in any way: " + matchInfo, matchInfo); @@ -535,9 +535,9 @@ public class ReflectionHelperTests extends AbstractExpressionTests { assertEquals(expected,actual); } - private List getTypeDescriptors(Class... types) { + private List getTypeDescriptors(Class... types) { List typeDescriptors = new ArrayList(types.length); - for (Class type : types) { + for (Class type : types) { typeDescriptors.add(TypeDescriptor.valueOf(type)); } return typeDescriptors;