From b60cc54b1e6a73708e124033e5485d7364bda368 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:25:55 +0100 Subject: [PATCH] Update tests for 6.2 See gh-33861 --- .../expression/spel/ast/AstUtilsTests.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/ast/AstUtilsTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/ast/AstUtilsTests.java index 174fdff9041e..d9b2c507ecbb 100644 --- a/spring-expression/src/test/java/org/springframework/expression/spel/ast/AstUtilsTests.java +++ b/spring-expression/src/test/java/org/springframework/expression/spel/ast/AstUtilsTests.java @@ -18,7 +18,6 @@ import java.util.List; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.expression.EvaluationContext; @@ -79,17 +78,10 @@ void singleExactTypeMatch() { @Test void exactTypeMatches() { List accessorsToTry = getPropertyAccessorsToTry(new Cat(), accessors); - // We would actually expect the following. - // assertThat(accessorsToTry).containsExactly( - // cat1Accessor, cat2Accessor, animal1Accessor, animal2Accessor, generic1Accessor, generic2Accessor); - // However, prior to Spring Framework 6.2, the supertype and generic accessors are not - // ordered properly. So we test that the exact matches come first and in the expected order. - assertThat(accessorsToTry) - .hasSize(accessors.size()) - .startsWith(cat1Accessor, cat2Accessor); + assertThat(accessorsToTry).containsExactly( + cat1Accessor, cat2Accessor, animal1Accessor, animal2Accessor, generic1Accessor, generic2Accessor); } - @Disabled("PropertyAccessor ordering for supertype and generic matches is broken prior to Spring Framework 6.2") @Test void supertypeMatches() { List accessorsToTry = getPropertyAccessorsToTry(new Dog(), accessors); @@ -109,7 +101,7 @@ private static PropertyAccessor createAccessor(String name, Class type) { } private static List getPropertyAccessorsToTry(Object target, List propertyAccessors) { - return AstUtils.getPropertyAccessorsToTry(target.getClass(), propertyAccessors); + return AstUtils.getAccessorsToTry(target, propertyAccessors); }