18
18
19
19
import java .util .List ;
20
20
21
- import org .junit .jupiter .api .Disabled ;
22
21
import org .junit .jupiter .api .Test ;
23
22
24
23
import org .springframework .expression .EvaluationContext ;
@@ -79,17 +78,10 @@ void singleExactTypeMatch() {
79
78
@ Test
80
79
void exactTypeMatches () {
81
80
List <PropertyAccessor > accessorsToTry = getPropertyAccessorsToTry (new Cat (), accessors );
82
- // We would actually expect the following.
83
- // assertThat(accessorsToTry).containsExactly(
84
- // cat1Accessor, cat2Accessor, animal1Accessor, animal2Accessor, generic1Accessor, generic2Accessor);
85
- // However, prior to Spring Framework 6.2, the supertype and generic accessors are not
86
- // ordered properly. So we test that the exact matches come first and in the expected order.
87
- assertThat (accessorsToTry )
88
- .hasSize (accessors .size ())
89
- .startsWith (cat1Accessor , cat2Accessor );
81
+ assertThat (accessorsToTry ).containsExactly (
82
+ cat1Accessor , cat2Accessor , animal1Accessor , animal2Accessor , generic1Accessor , generic2Accessor );
90
83
}
91
84
92
- @ Disabled ("PropertyAccessor ordering for supertype and generic matches is broken prior to Spring Framework 6.2" )
93
85
@ Test
94
86
void supertypeMatches () {
95
87
List <PropertyAccessor > accessorsToTry = getPropertyAccessorsToTry (new Dog (), accessors );
@@ -109,7 +101,7 @@ private static PropertyAccessor createAccessor(String name, Class<?> type) {
109
101
}
110
102
111
103
private static List <PropertyAccessor > getPropertyAccessorsToTry (Object target , List <PropertyAccessor > propertyAccessors ) {
112
- return AstUtils .getPropertyAccessorsToTry (target . getClass () , propertyAccessors );
104
+ return AstUtils .getAccessorsToTry (target , propertyAccessors );
113
105
}
114
106
115
107
0 commit comments