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 2c2ef12 commit 94bbf85
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down 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
@@ -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.
Expand Down Expand Up @@ -1448,7 +1448,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
@@ -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.
Expand Down Expand Up @@ -1817,7 +1817,6 @@ else if (beanName.equals("goo")) {
static class CCC {

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

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

Expand Down Expand Up @@ -1964,7 +1962,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 94bbf85

Please sign in to comment.