diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/AbstractExpressionTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/AbstractExpressionTests.java index 0e133522f6..867076e121 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/AbstractExpressionTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/AbstractExpressionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2023 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. @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; */ public abstract class AbstractExpressionTests { - private static final boolean DEBUG = false; + protected static final boolean DEBUG = false; protected static final boolean SHOULD_BE_WRITABLE = true; @@ -202,7 +202,9 @@ public abstract class AbstractExpressionTests { protected void parseAndCheckError(String expression, SpelMessage expectedMessage, Object... otherProperties) { assertThatExceptionOfType(SpelParseException.class).isThrownBy(() -> { Expression expr = parser.parseExpression(expression); - SpelUtilities.printAbstractSyntaxTree(System.out, expr); + if (DEBUG) { + SpelUtilities.printAbstractSyntaxTree(System.out, expr); + } }).satisfies(ex -> { assertThat(ex.getMessageCode()).isEqualTo(expectedMessage); if (otherProperties != null && otherProperties.length != 0) { diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/EvaluationTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/EvaluationTests.java index 5a628c7051..ec2fcfc55e 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/EvaluationTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/EvaluationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 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. @@ -1448,7 +1448,9 @@ class EvaluationTests extends AbstractExpressionTests { private void expectFail(ExpressionParser parser, EvaluationContext eContext, String expressionString, SpelMessage messageCode) { assertThatExceptionOfType(SpelEvaluationException.class).isThrownBy(() -> { Expression e = parser.parseExpression(expressionString); - SpelUtilities.printAbstractSyntaxTree(System.out, e); + if (DEBUG) { + SpelUtilities.printAbstractSyntaxTree(System.out, e); + } e.getValue(eContext); }).satisfies(ex -> assertThat(ex.getMessageCode()).isEqualTo(messageCode)); } diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java index 35011fba21..94aa7468cf 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 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. @@ -1817,7 +1817,6 @@ class SpelReproTests extends AbstractExpressionTests { static class CCC { public boolean method(Object o) { - System.out.println(o); return false; } } @@ -1889,7 +1888,6 @@ class SpelReproTests extends AbstractExpressionTests { static class Foo2 { public void execute(String str) { - System.out.println("Value: " + str); } } @@ -1964,7 +1962,6 @@ class SpelReproTests extends AbstractExpressionTests { public static class ReflectionUtil { public Object methodToCall(T param) { - System.out.println(param + " " + param.getClass()); return "Object methodToCall(T param)"; }