Skip to content

Commit

Permalink
Set default values for sort fields in PagingRequest (#809)
Browse files Browse the repository at this point in the history
  • Loading branch information
sleberknight authored Nov 28, 2022
1 parent 2ed7d6b commit 49efb53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/kiwiproject/spring/data/PagingRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class PagingRequest implements PagingParams {
*/
@QueryParam("primaryDirection")
@DefaultValue("ASC")
private Sort.Direction primaryDirection;
private Sort.Direction primaryDirection = Sort.Direction.ASC;

/**
* The secondary sort property. Default is null.
Expand All @@ -82,5 +82,5 @@ public class PagingRequest implements PagingParams {
*/
@QueryParam("secondaryDirection")
@DefaultValue("ASC")
private Sort.Direction secondaryDirection;
private Sort.Direction secondaryDirection = Sort.Direction.ASC;
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ void shouldCreateInstanceWithExpectedDefaults(SoftAssertions softly) {
softly.assertThat(pagingRequest.getPage()).isZero();
softly.assertThat(pagingRequest.getLimit()).isEqualTo(100);
softly.assertThat(pagingRequest.getPrimarySort()).isNull();
softly.assertThat(pagingRequest.getPrimaryDirection()).isNull();
softly.assertThat(pagingRequest.getPrimaryDirection()).isEqualTo(Sort.Direction.ASC);
softly.assertThat(pagingRequest.getSecondarySort()).isNull();
softly.assertThat(pagingRequest.getSecondaryDirection()).isNull();
softly.assertThat(pagingRequest.getSecondaryDirection()).isEqualTo(Sort.Direction.ASC);
}

@Test
Expand Down

0 comments on commit 49efb53

Please sign in to comment.