Skip to content

Commit

Permalink
Stop printing to System.out in SpEL tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Mar 19, 2023
1 parent 46bd6ad commit dd4a347
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
public abstract class AbstractExpressionTests {

private static final boolean DEBUG = false;
protected static final boolean DEBUG = false;

protected static final boolean SHOULD_BE_WRITABLE = true;

Expand Down Expand Up @@ -202,7 +202,9 @@ protected void evaluateAndCheckError(String expression, Class<?> expectedReturnT
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,9 @@ private void expectFailNotDecrementable(ExpressionParser parser, EvaluationConte
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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1811,7 +1811,6 @@ else if (beanName.equals("goo")) {
static class CCC {

public boolean method(Object o) {
System.out.println(o);
return false;
}
}
Expand Down Expand Up @@ -1883,7 +1882,6 @@ static class Foo {
static class Foo2 {

public void execute(String str) {
System.out.println("Value: " + str);
}
}

Expand Down Expand Up @@ -1958,7 +1956,6 @@ public String process(String... args) {
public static class ReflectionUtil<T extends Number> {

public Object methodToCall(T param) {
System.out.println(param + " " + param.getClass());
return "Object methodToCall(T param)";
}

Expand Down

0 comments on commit dd4a347

Please sign in to comment.