Skip to content

Commit

Permalink
Adapt to changes in Spring Data Commons' SortHandlerMethodArgumentRes…
Browse files Browse the repository at this point in the history
…olver.

Fixes GH-2339.
Related ticket: spring-projects/spring-data-commons#2531.
  • Loading branch information
odrotbohm committed Dec 13, 2023
1 parent 19c3179 commit 0e62f5d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ void rendersCorrectSearchLinksForPersons() throws Exception {
tester.assertNumberOfLinks(7); // Self link included
tester.assertHasLinkEndingWith("findFirstPersonByFirstName",
"findFirstPersonByFirstName{?firstname,projection}");
tester.assertHasLinkEndingWith("firstname", "firstname{?firstname,page,size,sort,projection}");
tester.assertHasLinkEndingWith("lastname", "lastname{?lastname,sort,projection}");
tester.assertHasLinkEndingWith("firstname", "firstname{?firstname,page,size,sort*,projection}");
tester.assertHasLinkEndingWith("lastname", "lastname{?lastname,sort*,projection}");
tester.assertHasLinkEndingWith("findByCreatedUsingISO8601Date",
"findByCreatedUsingISO8601Date{?date,page,size,sort,projection}");
"findByCreatedUsingISO8601Date{?date,page,size,sort*,projection}");
tester.assertHasLinkEndingWith("findByCreatedGreaterThan",
"findByCreatedGreaterThan{?date,page,size,sort,projection}");
"findByCreatedGreaterThan{?date,page,size,sort*,projection}");
tester.assertHasLinkEndingWith("findCreatedDateByLastName", "findCreatedDateByLastName{?lastname}");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,12 @@ void exectuesSearchThatTakesASort() throws Exception {
assertThat(findBySortedLink.getVariableNames()).contains("sort", "projection");

// Assert results returned as specified
client.follow(findBySortedLink.expand(Arrays.asList("title", "desc"))).//
client.follow(findBySortedLink.expand("title,desc")).//
andExpect(jsonPath("$._embedded.books[0].title").value("Spring Data (Second Edition)")).//
andExpect(jsonPath("$._embedded.books[1].title").value("Spring Data")).//
andExpect(client.hasLinkWithRel(IanaLinkRelations.SELF));

client.follow(findBySortedLink.expand(Arrays.asList("title", "asc"))).//
client.follow(findBySortedLink.expand("title,asc")).//
andExpect(jsonPath("$._embedded.books[0].title").value("Spring Data")).//
andExpect(jsonPath("$._embedded.books[1].title").value("Spring Data (Second Edition)")).//
andExpect(client.hasLinkWithRel(IanaLinkRelations.SELF));
Expand Down Expand Up @@ -649,12 +649,12 @@ void exectuesSearchThatTakesAMappedSortProperty() throws Exception {
assertThat(findBySortedLink.getVariableNames()).contains("sort", "projection");

// Assert results returned as specified
client.follow(findBySortedLink.expand(Arrays.asList("sales", "desc"))).//
client.follow(findBySortedLink.expand("sales,desc")).//
andExpect(jsonPath("$._embedded.books[0].title").value("Spring Data (Second Edition)")).//
andExpect(jsonPath("$._embedded.books[1].title").value("Spring Data")).//
andExpect(client.hasLinkWithRel(IanaLinkRelations.SELF));

client.follow(findBySortedLink.expand(Arrays.asList("sales", "asc"))).//
client.follow(findBySortedLink.expand("sales,asc")).//
andExpect(jsonPath("$._embedded.books[0].title").value("Spring Data")).//
andExpect(jsonPath("$._embedded.books[1].title").value("Spring Data (Second Edition)")).//
andExpect(client.hasLinkWithRel(IanaLinkRelations.SELF));
Expand All @@ -669,12 +669,12 @@ void exectuesCustomQuerySearchThatTakesAMappedSortProperty() throws Exception {
assertThat(findByLink.isTemplated()).isTrue();

// Assert results returned as specified
client.follow(findByLink.expand("0", "10", Arrays.asList("sales", "desc"))).//
client.follow(findByLink.expand("0", "10", "sales,desc")).//
andExpect(jsonPath("$._embedded.books[0].title").value("Spring Data (Second Edition)")).//
andExpect(jsonPath("$._embedded.books[1].title").value("Spring Data")).//
andExpect(client.hasLinkWithRel(IanaLinkRelations.SELF));

client.follow(findByLink.expand("0", "10", Arrays.asList("unknown", "asc", "sales", "asc"))).//
client.follow(findByLink.expand("0", "10", Arrays.asList("unknown,asc", "sales,asc"))).//
andExpect(jsonPath("$._embedded.books[0].title").value("Spring Data")).//
andExpect(jsonPath("$._embedded.books[1].title").value("Spring Data (Second Edition)")).//
andExpect(client.hasLinkWithRel(IanaLinkRelations.SELF));
Expand Down Expand Up @@ -706,7 +706,7 @@ void appliesSortByEmbeddedAssociation() throws Exception {
assertThat(findBySortedLink.getVariableNames()).contains("sort", "projection");

// Assert results returned as specified
client.follow(findBySortedLink.expand(Arrays.asList("offer.price", "desc"))).//
client.follow(findBySortedLink.expand("offer.price,desc")).//
andExpect(jsonPath("$._embedded.books[0].title").value("Spring Data (Second Edition)")).//
andExpect(jsonPath("$._embedded.books[1].title").value("Spring Data")).//
andExpect(client.hasLinkWithRel(IanaLinkRelations.SELF));
Expand Down

0 comments on commit 0e62f5d

Please sign in to comment.