Skip to content

Commit

Permalink
Update tests for 6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrannen committed Nov 8, 2024
1 parent 4435275 commit b60cc54
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -79,17 +78,10 @@ void singleExactTypeMatch() {
@Test
void exactTypeMatches() {
List<PropertyAccessor> 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<PropertyAccessor> accessorsToTry = getPropertyAccessorsToTry(new Dog(), accessors);
Expand All @@ -109,7 +101,7 @@ private static PropertyAccessor createAccessor(String name, Class<?> type) {
}

private static List<PropertyAccessor> getPropertyAccessorsToTry(Object target, List<PropertyAccessor> propertyAccessors) {
return AstUtils.getPropertyAccessorsToTry(target.getClass(), propertyAccessors);
return AstUtils.getAccessorsToTry(target, propertyAccessors);
}


Expand Down

0 comments on commit b60cc54

Please sign in to comment.