'Why does Spring Data's Sort.descending() reset ignoreCase?
Sort.descending() javadoc states
"Returns a new Sort with the current setup but descending order direction."
Why does this test fail on the second assert? I would assume (and would like) Sort.descending() to keep ignoreCase as it is (true), but in practice it changes ignoreCase to false?
@Test
public void descendingSortShouldRetainCaseInsensitive() {
var sort = Sort.by(Sort.Order.by("memberName").ignoreCase());
assertTrue(sort.iterator().next().isIgnoreCase()); // 1 OK
var sortDesc = sort.descending();
assertTrue(sortDesc.iterator().next().isIgnoreCase()); // 2 fails
}
Solution 1:[1]
It seems this was a bug, and has now been fixed: https://github.com/spring-projects/spring-data-commons/issues/2585
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Janne Mattila |
