Skip to content

Commit

Permalink
replaced custom pageableRequest by spring page
Browse files Browse the repository at this point in the history
  • Loading branch information
melistik committed May 16, 2019
1 parent 8b0b766 commit ac636be
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import io.rocketbase.commons.dto.ErrorResponse;
import io.rocketbase.commons.dto.PageableResult;
import io.rocketbase.commons.exception.BadRequestException;
import io.rocketbase.commons.request.PageableRequest;
import io.rocketbase.sample.dto.company.CompanyRead;
import io.rocketbase.sample.dto.company.CompanyWrite;
import io.rocketbase.sample.model.CompanyEntity;
Expand All @@ -15,6 +14,7 @@
import org.mockito.Mockito;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
Expand Down Expand Up @@ -69,7 +69,7 @@ public void shouldNotGetUnknownCompany() throws Exception {
// given

// when
Optional<CompanyRead> data = companyResource.getById("notexisting");
Optional<CompanyRead> data = companyResource.getById("notexisting");

// then
assertThat(data, equalTo(Optional.empty()));
Expand Down Expand Up @@ -203,9 +203,7 @@ public void shouldSortAsc() {


// when
PageableResult<CompanyRead> result = companyResource.find(PageableRequest.builder()
.sort(new Sort(Sort.Direction.ASC, "name"))
.build());
PageableResult<CompanyRead> result = companyResource.find(PageRequest.of(0, 100, Sort.Direction.ASC, "name"));

// then
assertThat(result, notNullValue());
Expand All @@ -230,9 +228,7 @@ public void shouldSortDesc() {


// when
PageableResult<CompanyRead> result = companyResource.find(PageableRequest.builder()
.sort(new Sort(Sort.Direction.DESC, "name"))
.build());
PageableResult<CompanyRead> result = companyResource.find(PageRequest.of(0, 100, Sort.Direction.DESC, "name"));

// then
assertThat(result, notNullValue());
Expand Down

0 comments on commit ac636be

Please sign in to comment.