"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spring-expression/src/test/java/org/springframework/expression/spel/EvaluationTests.java" between
spring-framework-5.3.23.tar.gz and spring-framework-5.3.24.tar.gz

About: Spring Framework is an application framework for the Java platform and .NET Framework. Community edition.

EvaluationTests.java  (spring-framework-5.3.23):EvaluationTests.java  (spring-framework-5.3.24)
skipping to change at line 119 skipping to change at line 119
assertThat(o).isNotNull(); assertThat(o).isNotNull();
assertThatExceptionOfType(SpelEvaluationException.class). isThrownBy(() -> assertThatExceptionOfType(SpelEvaluationException.class). isThrownBy(() ->
parser.parseExpression("wibble2.bar").getValue(ctx)); parser.parseExpression("wibble2.bar").getValue(ctx));
} }
@Test @Test
void elvisOperator() { void elvisOperator() {
evaluate("'Andy'?:'Dave'", "Andy", String.class); evaluate("'Andy'?:'Dave'", "Andy", String.class);
evaluate("null?:'Dave'", "Dave", String.class); evaluate("null?:'Dave'", "Dave", String.class);
evaluate("3?:1", 3, Integer.class);
evaluate("(2*3)?:1*10", 6, Integer.class);
evaluate("null?:2*10", 20, Integer.class);
evaluate("(null?:1)*10", 10, Integer.class);
} }
@Test @Test
void safeNavigation() { void safeNavigation() {
evaluate("null?.null?.null", null, null); evaluate("null?.null?.null", null, null);
} }
@Test // SPR-16731 @Test // SPR-16731
void matchesWithPatternAccessThreshold() { void matchesWithPatternAccessThreshold() {
String pattern = "^(?=[a-z0-9-]{1,47})([a-z0-9]+[-]{0,1}) {1,47}[a-z0-9]{1}$"; String pattern = "^(?=[a-z0-9-]{1,47})([a-z0-9]+[-]{0,1}) {1,47}[a-z0-9]{1}$";
skipping to change at line 628 skipping to change at line 632
@Test @Test
void ternaryOperator05() { void ternaryOperator05() {
evaluate("1>2?#var=4:#var=5", 5, Integer.class); evaluate("1>2?#var=4:#var=5", 5, Integer.class);
evaluate("3?:#var=5", 3, Integer.class); evaluate("3?:#var=5", 3, Integer.class);
evaluate("null?:#var=5", 5, Integer.class); evaluate("null?:#var=5", 5, Integer.class);
evaluate("2>4?(3>2?true:false):(5<3?true:false)", false, Boolean.class); evaluate("2>4?(3>2?true:false):(5<3?true:false)", false, Boolean.class);
} }
@Test @Test
void ternaryOperator06() {
evaluate("3?:#var=5", 3, Integer.class);
evaluate("null?:#var=5", 5, Integer.class);
evaluate("2>4?(3>2?true:false):(5<3?true:false)", false,
Boolean.class);
}
@Test
void ternaryExpressionWithImplicitGrouping() {
evaluate("4 % 2 == 0 ? 2 : 3 * 10", 2, Integer.class);
evaluate("4 % 2 == 1 ? 2 : 3 * 10", 30, Integer.class);
}
@Test
void ternaryExpressionWithExplicitGrouping() {
evaluate("((4 % 2 == 0) ? 2 : 1) * 10", 20, Integer.class
);
}
@Test
void ternaryOperatorWithNullValue() { void ternaryOperatorWithNullValue() {
assertThatExceptionOfType(EvaluationException.class).isTh rownBy( assertThatExceptionOfType(EvaluationException.class).isTh rownBy(
parser.parseExpression("null ? 0 : 1")::g etValue); parser.parseExpression("null ? 0 : 1")::g etValue);
} }
} }
@Nested @Nested
class MethodConstructorAndFunctionInvocationTests { class MethodConstructorAndFunctionInvocationTests {
 End of changes. 2 change blocks. 
0 lines changed or deleted 24 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)