Adapt test cases to adhere to RFC URI template expansion.
This commit is contained in:
@@ -28,6 +28,7 @@ import net.minidev.json.JSONArray;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -50,6 +51,7 @@ import org.springframework.hateoas.server.LinkRelationProvider;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
@@ -550,12 +552,13 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertThat(findBySortedLink.getVariableNames()).contains("sort", "projection");
|
||||
|
||||
// Assert results returned as specified
|
||||
client.follow(findBySortedLink.expand("title,desc")).//
|
||||
client.follow(findBySortedLink.expand(Arrays.asList("title", "desc"))).//
|
||||
andDo(MockMvcResultHandlers.print()).//
|
||||
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("title,asc")).//
|
||||
client.follow(findBySortedLink.expand(Arrays.asList("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));
|
||||
@@ -645,12 +648,12 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertThat(findBySortedLink.getVariableNames()).contains("sort", "projection");
|
||||
|
||||
// Assert results returned as specified
|
||||
client.follow(findBySortedLink.expand("sales,desc")).//
|
||||
client.follow(findBySortedLink.expand(Arrays.asList("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("sales,asc")).//
|
||||
client.follow(findBySortedLink.expand(Arrays.asList("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));
|
||||
@@ -665,12 +668,12 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertThat(findByLink.isTemplated()).isTrue();
|
||||
|
||||
// Assert results returned as specified
|
||||
client.follow(findByLink.expand("0", "10", "sales,desc")).//
|
||||
client.follow(findByLink.expand("0", "10", Arrays.asList("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", "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));
|
||||
@@ -695,7 +698,7 @@ public class JpaWebTests extends CommonWebTests {
|
||||
assertThat(findBySortedLink.getVariableNames()).contains("sort", "projection");
|
||||
|
||||
// Assert results returned as specified
|
||||
client.follow(findBySortedLink.expand("offer.price,desc")).//
|
||||
client.follow(findBySortedLink.expand(Arrays.asList("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));
|
||||
|
||||
Reference in New Issue
Block a user