Simplify some redundant code
Closes gh-24586 Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
This commit is contained in:
@@ -162,8 +162,7 @@ public class ConstructorInvocationTests extends AbstractExpressionTests {
|
||||
ctx.addConstructorResolver(dummy);
|
||||
assertThat(ctx.getConstructorResolvers().size()).isEqualTo(2);
|
||||
|
||||
List<ConstructorResolver> copy = new ArrayList<>();
|
||||
copy.addAll(ctx.getConstructorResolvers());
|
||||
List<ConstructorResolver> copy = new ArrayList<>(ctx.getConstructorResolvers());
|
||||
assertThat(ctx.removeConstructorResolver(dummy)).isTrue();
|
||||
assertThat(ctx.removeConstructorResolver(dummy)).isFalse();
|
||||
assertThat(ctx.getConstructorResolvers().size()).isEqualTo(1);
|
||||
|
||||
@@ -96,8 +96,7 @@ public class ExpressionLanguageScenarioTests extends AbstractExpressionTests {
|
||||
// Use the standard evaluation context
|
||||
StandardEvaluationContext ctx = new StandardEvaluationContext();
|
||||
ctx.setVariable("favouriteColour","blue");
|
||||
List<Integer> primes = new ArrayList<>();
|
||||
primes.addAll(Arrays.asList(2,3,5,7,11,13,17));
|
||||
List<Integer> primes = Arrays.asList(2, 3, 5, 7, 11, 13, 17);
|
||||
ctx.setVariable("primes",primes);
|
||||
|
||||
Expression expr = parser.parseRaw("#favouriteColour");
|
||||
|
||||
@@ -221,8 +221,7 @@ public class MethodInvocationTests extends AbstractExpressionTests {
|
||||
ctx.addMethodResolver(dummy);
|
||||
assertThat(ctx.getMethodResolvers().size()).isEqualTo(2);
|
||||
|
||||
List<MethodResolver> copy = new ArrayList<>();
|
||||
copy.addAll(ctx.getMethodResolvers());
|
||||
List<MethodResolver> copy = new ArrayList<>(ctx.getMethodResolvers());
|
||||
assertThat(ctx.removeMethodResolver(dummy)).isTrue();
|
||||
assertThat(ctx.removeMethodResolver(dummy)).isFalse();
|
||||
assertThat(ctx.getMethodResolvers().size()).isEqualTo(1);
|
||||
|
||||
@@ -135,8 +135,7 @@ public class PropertyAccessTests extends AbstractExpressionTests {
|
||||
ctx.addPropertyAccessor(spa);
|
||||
assertThat(ctx.getPropertyAccessors().size()).isEqualTo(2);
|
||||
|
||||
List<PropertyAccessor> copy = new ArrayList<>();
|
||||
copy.addAll(ctx.getPropertyAccessors());
|
||||
List<PropertyAccessor> copy = new ArrayList<>(ctx.getPropertyAccessors());
|
||||
assertThat(ctx.removePropertyAccessor(spa)).isTrue();
|
||||
assertThat(ctx.removePropertyAccessor(spa)).isFalse();
|
||||
assertThat(ctx.getPropertyAccessors().size()).isEqualTo(1);
|
||||
|
||||
@@ -420,8 +420,7 @@ public class SpelDocumentationTests extends AbstractExpressionTests {
|
||||
@Test
|
||||
public void testSpecialVariables() throws Exception {
|
||||
// create an array of integers
|
||||
List<Integer> primes = new ArrayList<>();
|
||||
primes.addAll(Arrays.asList(2,3,5,7,11,13,17));
|
||||
List<Integer> primes = Arrays.asList(2, 3, 5, 7, 11, 13, 17);
|
||||
|
||||
// create parser and set variable 'primes' as the array of integers
|
||||
ExpressionParser parser = new SpelExpressionParser();
|
||||
@@ -518,4 +517,3 @@ public class SpelDocumentationTests extends AbstractExpressionTests {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user