28
28
29
29
import java .math .BigDecimal ;
30
30
import java .util .ArrayList ;
31
+ import java .util .Arrays ;
31
32
import java .util .Collections ;
32
33
import java .util .List ;
33
34
import java .util .Map ;
50
51
import org .springframework .http .MediaType ;
51
52
import org .springframework .mock .web .MockHttpServletResponse ;
52
53
import org .springframework .test .context .ContextConfiguration ;
54
+ import org .springframework .test .web .servlet .result .MockMvcResultHandlers ;
53
55
import org .springframework .transaction .annotation .Transactional ;
54
56
import org .springframework .util .LinkedMultiValueMap ;
55
57
import org .springframework .util .MultiValueMap ;
@@ -550,12 +552,13 @@ public void exectuesSearchThatTakesASort() throws Exception {
550
552
assertThat (findBySortedLink .getVariableNames ()).contains ("sort" , "projection" );
551
553
552
554
// 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 ()).//
554
557
andExpect (jsonPath ("$._embedded.books[0].title" ).value ("Spring Data (Second Edition)" )).//
555
558
andExpect (jsonPath ("$._embedded.books[1].title" ).value ("Spring Data" )).//
556
559
andExpect (client .hasLinkWithRel (IanaLinkRelations .SELF ));
557
560
558
- client .follow (findBySortedLink .expand ("title, asc" )).//
561
+ client .follow (findBySortedLink .expand (Arrays . asList ( "title" , " asc") )).//
559
562
andExpect (jsonPath ("$._embedded.books[0].title" ).value ("Spring Data" )).//
560
563
andExpect (jsonPath ("$._embedded.books[1].title" ).value ("Spring Data (Second Edition)" )).//
561
564
andExpect (client .hasLinkWithRel (IanaLinkRelations .SELF ));
@@ -645,12 +648,12 @@ public void exectuesSearchThatTakesAMappedSortProperty() throws Exception {
645
648
assertThat (findBySortedLink .getVariableNames ()).contains ("sort" , "projection" );
646
649
647
650
// Assert results returned as specified
648
- client .follow (findBySortedLink .expand ("sales, desc" )).//
651
+ client .follow (findBySortedLink .expand (Arrays . asList ( "sales" , " desc") )).//
649
652
andExpect (jsonPath ("$._embedded.books[0].title" ).value ("Spring Data (Second Edition)" )).//
650
653
andExpect (jsonPath ("$._embedded.books[1].title" ).value ("Spring Data" )).//
651
654
andExpect (client .hasLinkWithRel (IanaLinkRelations .SELF ));
652
655
653
- client .follow (findBySortedLink .expand ("sales, asc" )).//
656
+ client .follow (findBySortedLink .expand (Arrays . asList ( "sales" , " asc") )).//
654
657
andExpect (jsonPath ("$._embedded.books[0].title" ).value ("Spring Data" )).//
655
658
andExpect (jsonPath ("$._embedded.books[1].title" ).value ("Spring Data (Second Edition)" )).//
656
659
andExpect (client .hasLinkWithRel (IanaLinkRelations .SELF ));
@@ -665,12 +668,12 @@ public void exectuesCustomQuerySearchThatTakesAMappedSortProperty() throws Excep
665
668
assertThat (findByLink .isTemplated ()).isTrue ();
666
669
667
670
// 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") )).//
669
672
andExpect (jsonPath ("$._embedded.books[0].title" ).value ("Spring Data (Second Edition)" )).//
670
673
andExpect (jsonPath ("$._embedded.books[1].title" ).value ("Spring Data" )).//
671
674
andExpect (client .hasLinkWithRel (IanaLinkRelations .SELF ));
672
675
673
- client .follow (findByLink .expand ("0" , "10" , "unknown, asc, sales, asc" )).//
676
+ client .follow (findByLink .expand ("0" , "10" , Arrays . asList ( "unknown" , " asc" , " sales" , " asc") )).//
674
677
andExpect (jsonPath ("$._embedded.books[0].title" ).value ("Spring Data" )).//
675
678
andExpect (jsonPath ("$._embedded.books[1].title" ).value ("Spring Data (Second Edition)" )).//
676
679
andExpect (client .hasLinkWithRel (IanaLinkRelations .SELF ));
@@ -695,7 +698,7 @@ public void appliesSortByEmbeddedAssociation() throws Exception {
695
698
assertThat (findBySortedLink .getVariableNames ()).contains ("sort" , "projection" );
696
699
697
700
// Assert results returned as specified
698
- client .follow (findBySortedLink .expand ("offer.price, desc" )).//
701
+ client .follow (findBySortedLink .expand (Arrays . asList ( "offer.price" , " desc") )).//
699
702
andExpect (jsonPath ("$._embedded.books[0].title" ).value ("Spring Data (Second Edition)" )).//
700
703
andExpect (jsonPath ("$._embedded.books[1].title" ).value ("Spring Data" )).//
701
704
andExpect (client .hasLinkWithRel (IanaLinkRelations .SELF ));
0 commit comments