Skip to content

Commit 94bbf85

Browse files
committed
Stop printing to System.out in SpEL tests
1 parent 2c2ef12 commit 94bbf85

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

spring-expression/src/test/java/org/springframework/expression/spel/AbstractExpressionTests.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
3535
*/
3636
public abstract class AbstractExpressionTests {
3737

38-
private static final boolean DEBUG = false;
38+
protected static final boolean DEBUG = false;
3939

4040
protected static final boolean SHOULD_BE_WRITABLE = true;
4141

@@ -202,7 +202,9 @@ protected void evaluateAndCheckError(String expression, Class<?> expectedReturnT
202202
protected void parseAndCheckError(String expression, SpelMessage expectedMessage, Object... otherProperties) {
203203
assertThatExceptionOfType(SpelParseException.class).isThrownBy(() -> {
204204
Expression expr = parser.parseExpression(expression);
205-
SpelUtilities.printAbstractSyntaxTree(System.out, expr);
205+
if (DEBUG) {
206+
SpelUtilities.printAbstractSyntaxTree(System.out, expr);
207+
}
206208
}).satisfies(ex -> {
207209
assertThat(ex.getMessageCode()).isEqualTo(expectedMessage);
208210
if (otherProperties != null && otherProperties.length != 0) {

spring-expression/src/test/java/org/springframework/expression/spel/EvaluationTests.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -1448,7 +1448,9 @@ private void expectFailNotDecrementable(ExpressionParser parser, EvaluationConte
14481448
private void expectFail(ExpressionParser parser, EvaluationContext eContext, String expressionString, SpelMessage messageCode) {
14491449
assertThatExceptionOfType(SpelEvaluationException.class).isThrownBy(() -> {
14501450
Expression e = parser.parseExpression(expressionString);
1451-
SpelUtilities.printAbstractSyntaxTree(System.out, e);
1451+
if (DEBUG) {
1452+
SpelUtilities.printAbstractSyntaxTree(System.out, e);
1453+
}
14521454
e.getValue(eContext);
14531455
}).satisfies(ex -> assertThat(ex.getMessageCode()).isEqualTo(messageCode));
14541456
}

spring-expression/src/test/java/org/springframework/expression/spel/SpelReproTests.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -1817,7 +1817,6 @@ else if (beanName.equals("goo")) {
18171817
static class CCC {
18181818

18191819
public boolean method(Object o) {
1820-
System.out.println(o);
18211820
return false;
18221821
}
18231822
}
@@ -1889,7 +1888,6 @@ static class Foo {
18891888
static class Foo2 {
18901889

18911890
public void execute(String str) {
1892-
System.out.println("Value: " + str);
18931891
}
18941892
}
18951893

@@ -1964,7 +1962,6 @@ public String process(String... args) {
19641962
public static class ReflectionUtil<T extends Number> {
19651963

19661964
public Object methodToCall(T param) {
1967-
System.out.println(param + " " + param.getClass());
19681965
return "Object methodToCall(T param)";
19691966
}
19701967

0 commit comments

Comments
 (0)