Skip to content

Commit a8c39eb

Browse files
committed
Adapt test cases to adhere to RFC URI template expansion.
1 parent b6cefe4 commit a8c39eb

File tree

1 file changed

+10
-7
lines changed
  • spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa

1 file changed

+10
-7
lines changed

spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import java.math.BigDecimal;
3030
import java.util.ArrayList;
31+
import java.util.Arrays;
3132
import java.util.Collections;
3233
import java.util.List;
3334
import java.util.Map;
@@ -50,6 +51,7 @@
5051
import org.springframework.http.MediaType;
5152
import org.springframework.mock.web.MockHttpServletResponse;
5253
import org.springframework.test.context.ContextConfiguration;
54+
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
5355
import org.springframework.transaction.annotation.Transactional;
5456
import org.springframework.util.LinkedMultiValueMap;
5557
import org.springframework.util.MultiValueMap;
@@ -550,12 +552,13 @@ public void exectuesSearchThatTakesASort() throws Exception {
550552
assertThat(findBySortedLink.getVariableNames()).contains("sort", "projection");
551553

552554
// Assert results returned as specified
553-
client.follow(findBySortedLink.expand("title,desc")).//
555+
client.follow(findBySortedLink.expand(Arrays.asList("title", "desc"))).//
556+
andDo(MockMvcResultHandlers.print()).//
554557
andExpect(jsonPath("$._embedded.books[0].title").value("Spring Data (Second Edition)")).//
555558
andExpect(jsonPath("$._embedded.books[1].title").value("Spring Data")).//
556559
andExpect(client.hasLinkWithRel(IanaLinkRelations.SELF));
557560

558-
client.follow(findBySortedLink.expand("title,asc")).//
561+
client.follow(findBySortedLink.expand(Arrays.asList("title", "asc"))).//
559562
andExpect(jsonPath("$._embedded.books[0].title").value("Spring Data")).//
560563
andExpect(jsonPath("$._embedded.books[1].title").value("Spring Data (Second Edition)")).//
561564
andExpect(client.hasLinkWithRel(IanaLinkRelations.SELF));
@@ -645,12 +648,12 @@ public void exectuesSearchThatTakesAMappedSortProperty() throws Exception {
645648
assertThat(findBySortedLink.getVariableNames()).contains("sort", "projection");
646649

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

653-
client.follow(findBySortedLink.expand("sales,asc")).//
656+
client.follow(findBySortedLink.expand(Arrays.asList("sales", "asc"))).//
654657
andExpect(jsonPath("$._embedded.books[0].title").value("Spring Data")).//
655658
andExpect(jsonPath("$._embedded.books[1].title").value("Spring Data (Second Edition)")).//
656659
andExpect(client.hasLinkWithRel(IanaLinkRelations.SELF));
@@ -665,12 +668,12 @@ public void exectuesCustomQuerySearchThatTakesAMappedSortProperty() throws Excep
665668
assertThat(findByLink.isTemplated()).isTrue();
666669

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

673-
client.follow(findByLink.expand("0", "10", "unknown,asc,sales,asc")).//
676+
client.follow(findByLink.expand("0", "10", Arrays.asList("unknown", "asc", "sales", "asc"))).//
674677
andExpect(jsonPath("$._embedded.books[0].title").value("Spring Data")).//
675678
andExpect(jsonPath("$._embedded.books[1].title").value("Spring Data (Second Edition)")).//
676679
andExpect(client.hasLinkWithRel(IanaLinkRelations.SELF));
@@ -695,7 +698,7 @@ public void appliesSortByEmbeddedAssociation() throws Exception {
695698
assertThat(findBySortedLink.getVariableNames()).contains("sort", "projection");
696699

697700
// Assert results returned as specified
698-
client.follow(findBySortedLink.expand("offer.price,desc")).//
701+
client.follow(findBySortedLink.expand(Arrays.asList("offer.price", "desc"))).//
699702
andExpect(jsonPath("$._embedded.books[0].title").value("Spring Data (Second Edition)")).//
700703
andExpect(jsonPath("$._embedded.books[1].title").value("Spring Data")).//
701704
andExpect(client.hasLinkWithRel(IanaLinkRelations.SELF));

0 commit comments

Comments
 (0)