Compare commits

..

1 commit

Author SHA1 Message Date
35b538c7ef TD-34: Endpoint for getting all players and tests 2025-03-05 08:46:45 +01:00
3 changed files with 6 additions and 6 deletions
src
main/java/de/towerdefence/server
test/java/de/towerdefence/server/server

View file

@ -66,7 +66,7 @@ public class AdminApiController implements AdminApi {
String sortBy = body.getSortBy();
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));

View file

@ -7,7 +7,7 @@ import org.springframework.stereotype.Component;
@Component
public class OrderToDirectionMapperService {
public Sort.Direction orderToDirection(PlayerFilter.OrderEnum order) {
public Sort.Direction OrderToDirection(PlayerFilter.OrderEnum order) {
if (order == PlayerFilter.OrderEnum.ASCENDING) {
return Sort.Direction.ASC;

View file

@ -47,8 +47,8 @@ class GetAllPlayersTest extends IntegrationTest {
this.mvc.perform(createGetAllPlayersRequest(requestBody))
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].username").value("Alex"))
.andExpect(jsonPath("$[1].username").value("Zorro"));
.andExpect(jsonPath("$[1].username").value("Alex"))
.andExpect(jsonPath("$[0].username").value("Zorro"));
}
@Test
@ -63,8 +63,8 @@ class GetAllPlayersTest extends IntegrationTest {
this.mvc.perform(createGetAllPlayersRequest(requestBody))
.andExpect(status().isOk())
.andExpect(jsonPath("$[1].username").value("Alex"))
.andExpect(jsonPath("$[0].username").value("Zorro"));
.andExpect(jsonPath("$[0].username").value("Alex"))
.andExpect(jsonPath("$[1].username").value("Zorro"));
}
@Test