Compare commits
1 commit
1e8c15d52f
...
35b538c7ef
Author | SHA1 | Date | |
---|---|---|---|
35b538c7ef |
3 changed files with 6 additions and 6 deletions
|
@ -66,7 +66,7 @@ public class AdminApiController implements AdminApi {
|
||||||
String sortBy = body.getSortBy();
|
String sortBy = body.getSortBy();
|
||||||
String username = body.getUsername();
|
String username = body.getUsername();
|
||||||
|
|
||||||
Sort.Direction direction = orderToDirectionMapperService.orderToDirection(order);
|
Sort.Direction direction = orderToDirectionMapperService.OrderToDirection(order);
|
||||||
|
|
||||||
Pageable pageable = PageRequest.of(page, pageSize, Sort.by(direction, sortBy));
|
Pageable pageable = PageRequest.of(page, pageSize, Sort.by(direction, sortBy));
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import org.springframework.stereotype.Component;
|
||||||
@Component
|
@Component
|
||||||
public class OrderToDirectionMapperService {
|
public class OrderToDirectionMapperService {
|
||||||
|
|
||||||
public Sort.Direction orderToDirection(PlayerFilter.OrderEnum order) {
|
public Sort.Direction OrderToDirection(PlayerFilter.OrderEnum order) {
|
||||||
|
|
||||||
if (order == PlayerFilter.OrderEnum.ASCENDING) {
|
if (order == PlayerFilter.OrderEnum.ASCENDING) {
|
||||||
return Sort.Direction.ASC;
|
return Sort.Direction.ASC;
|
||||||
|
|
|
@ -47,8 +47,8 @@ class GetAllPlayersTest extends IntegrationTest {
|
||||||
|
|
||||||
this.mvc.perform(createGetAllPlayersRequest(requestBody))
|
this.mvc.perform(createGetAllPlayersRequest(requestBody))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$[0].username").value("Alex"))
|
.andExpect(jsonPath("$[1].username").value("Alex"))
|
||||||
.andExpect(jsonPath("$[1].username").value("Zorro"));
|
.andExpect(jsonPath("$[0].username").value("Zorro"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -63,8 +63,8 @@ class GetAllPlayersTest extends IntegrationTest {
|
||||||
|
|
||||||
this.mvc.perform(createGetAllPlayersRequest(requestBody))
|
this.mvc.perform(createGetAllPlayersRequest(requestBody))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$[1].username").value("Alex"))
|
.andExpect(jsonPath("$[0].username").value("Alex"))
|
||||||
.andExpect(jsonPath("$[0].username").value("Zorro"));
|
.andExpect(jsonPath("$[1].username").value("Zorro"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Add table
Reference in a new issue