2828
2929import java .math .BigDecimal ;
3030import java .util .ArrayList ;
31+ import java .util .Arrays ;
3132import java .util .Collections ;
3233import java .util .List ;
3334import java .util .Map ;
5051import org .springframework .http .MediaType ;
5152import org .springframework .mock .web .MockHttpServletResponse ;
5253import org .springframework .test .context .ContextConfiguration ;
54+ import org .springframework .test .web .servlet .result .MockMvcResultHandlers ;
5355import org .springframework .transaction .annotation .Transactional ;
5456import org .springframework .util .LinkedMultiValueMap ;
5557import 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