Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ Release names follow the **historic football clubs** naming convention (A–Z):

### Changed

- Normalize player dataset: seed Leandro Paredes (squad 5) permanently; correct
Enzo Fernández (squad 24) to SL Benfica / Liga Portugal, Alexis Mac Allister
(squad 20) to Brighton & Hove Albion, and Lionel Messi (squad 10) to Paris
Saint-Germain / Ligue 1 — all reflecting November 2022 World Cup squads (#288)
- Align CRUD test fixtures: Giovani Lo Celso (squad 27) for Create and Delete,
Lionel Messi (squad 10) for Retrieve, Damián Martínez (squad 23) for Update;
canonical UUID v5 strings applied across `dml.sql`, `PlayerFakes`,
`PlayerDTOFakes`, and `storage/players-sqlite3.db` (#288)
- `Player` entity: `id` (UUID) is the database primary key — `@Id` with
`GenerationType.UUID`; `squadNumber` (Integer) carries `@Column(unique=true)`
and serves as the natural-key route identifier for `PUT` and `DELETE` (#268)
Expand All @@ -59,6 +67,8 @@ Release names follow the **historic football clubs** naming convention (A–Z):

### Added

- Repository delete test: `givenPlayerExists_whenDelete_thenPlayerIsRemoved`
covers Lo Celso inline save + delete pattern (#288)
- JaCoCo `check` goal added to Maven build enforcing 80% instruction and branch
coverage — replaces manual HTML report step in `/pre-commit` (#268)
- `.sonarcloud.properties`: SonarCloud Automatic Analysis configuration —
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,27 @@ private PlayerDTOFakes() {
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
}

private static UUID uuid(int index) {
return UUID.fromString(String.format("00000000-0000-0000-0000-%012d", index));
}

/**
* Leandro Paredes - Test data for CREATE operations
* Giovani Lo Celso - Test data for CREATE and DELETE operations
*
* Usage:
* - Service tests: Mock expected data for playersService.create()
* - Controller tests: Mock expected data for POST /players
* - Service tests: Mock expected data for playersService.create() / deleteBySquadNumber()
* - Controller tests: Mock expected data for POST /players and DELETE /players/{squadNumber}
*
* Note: Not pre-seeded in test DB (squad number 5 slot is empty)
* Note: Not pre-seeded in test DB (squad number 27 falls outside seeded range 1–26)
*/
public static PlayerDTO createOneValid() {
PlayerDTO playerDTO = new PlayerDTO();
playerDTO.setId(null); // Will be generated by @PrePersist
playerDTO.setSquadNumber(5);
playerDTO.setFirstName("Leandro");
playerDTO.setMiddleName("Daniel");
playerDTO.setLastName("Paredes");
playerDTO.setDateOfBirth(LocalDate.of(1994, 6, 29));
playerDTO.setPosition("Defensive Midfield");
playerDTO.setAbbrPosition("DM");
playerDTO.setTeam("AS Roma");
playerDTO.setLeague("Serie A");
playerDTO.setId(null); // Will be generated by GenerationType.UUID on save
playerDTO.setSquadNumber(27);
playerDTO.setFirstName("Giovani");
playerDTO.setMiddleName(null);
playerDTO.setLastName("Lo Celso");
playerDTO.setDateOfBirth(LocalDate.of(1996, 7, 9));
playerDTO.setPosition("Central Midfield");
playerDTO.setAbbrPosition("CM");
playerDTO.setTeam("Real Betis Balompié");
playerDTO.setLeague("La Liga");
playerDTO.setStarting11(false);
return playerDTO;
}
Expand All @@ -51,7 +47,7 @@ public static PlayerDTO createOneValid() {
*/
public static PlayerDTO createOneForUpdate() {
PlayerDTO playerDTO = new PlayerDTO();
playerDTO.setId(uuid(1));
playerDTO.setId(UUID.fromString("01772c59-43f0-5d85-b913-c78e4e281452"));
playerDTO.setSquadNumber(23);
playerDTO.setFirstName("Damián");
playerDTO.setMiddleName("Emiliano");
Expand All @@ -74,7 +70,7 @@ public static PlayerDTO createOneForUpdate() {
*/
public static PlayerDTO createOneUpdated() {
PlayerDTO playerDTO = new PlayerDTO();
playerDTO.setId(uuid(1));
playerDTO.setId(UUID.fromString("01772c59-43f0-5d85-b913-c78e4e281452"));
playerDTO.setSquadNumber(23);
playerDTO.setFirstName("Emiliano");
playerDTO.setMiddleName(null);
Expand Down Expand Up @@ -110,46 +106,45 @@ public static PlayerDTO createOneInvalid() {
}

/**
* ALL 26 players - Complete Argentina 2022 FIFA World Cup squad
* ALL 26 players - Complete Argentina 2022 FIFA World Cup squad (squads 1–26)
*/
public static List<PlayerDTO> createAll() {
return Arrays.asList(
// Starting 11
createPlayerDTO(uuid(1), 23, "Damián", "Emiliano", "Martínez", LocalDate.of(1992, 9, 2), "Goalkeeper", "GK", "Aston Villa FC", "Premier League", true),
createPlayerDTO(uuid(2), 26, "Nahuel", null, "Molina", LocalDate.of(1998, 4, 6), "Right-Back", "RB", "Atlético Madrid", "La Liga", true),
createPlayerDTO(uuid(3), 13, "Cristian", "Gabriel", "Romero", LocalDate.of(1998, 4, 27), "Centre-Back", "CB", "Tottenham Hotspur", "Premier League", true),
createPlayerDTO(uuid(4), 19, "Nicolás", "Hernán Gonzalo", "Otamendi", LocalDate.of(1988, 2, 12), "Centre-Back", "CB", "SL Benfica", "Liga Portugal", true),
createPlayerDTO(uuid(5), 3, "Nicolás", "Alejandro", "Tagliafico", LocalDate.of(1992, 8, 31), "Left-Back", "LB", "Olympique Lyon", "Ligue 1", true),
createPlayerDTO(uuid(6), 11, "Ángel", "Fabián", "Di María", LocalDate.of(1988, 2, 14), "Right Winger", "RW", "SL Benfica", "Liga Portugal", true),
createPlayerDTO(uuid(7), 7, "Rodrigo", "Javier", "de Paul", LocalDate.of(1994, 5, 24), "Central Midfield", "CM", "Atlético Madrid", "La Liga", true),
createPlayerDTO(uuid(8), 24, "Enzo", "Jeremías", "Fernández", LocalDate.of(2001, 1, 17), "Central Midfield", "CM", "Chelsea FC", "Premier League", true),
createPlayerDTO(uuid(9), 20, "Alexis", null, "Mac Allister", LocalDate.of(1998, 12, 24), "Central Midfield", "CM", "Liverpool FC", "Premier League", true),
createPlayerDTO(uuid(10), 10, "Lionel", "Andrés", "Messi", LocalDate.of(1987, 6, 24), "Right Winger", "RW", "Inter Miami CF", "Major League Soccer", true),
createPlayerDTO(uuid(11), 9, "Julián", null, "Álvarez", LocalDate.of(2000, 1, 31), "Centre-Forward", "CF", "Manchester City", "Premier League", true),
createPlayerDTO("01772c59-43f0-5d85-b913-c78e4e281452", 23, "Damián", "Emiliano", "Martínez", LocalDate.of(1992, 9, 2), "Goalkeeper", "GK", "Aston Villa FC", "Premier League", true),
createPlayerDTO("da31293b-4c7e-5e0f-a168-469ee29ecbc4", 26, "Nahuel", null, "Molina", LocalDate.of(1998, 4, 6), "Right-Back", "RB", "Atlético Madrid", "La Liga", true),
createPlayerDTO("c096c69e-762b-5281-9290-bb9c167a24a0", 13, "Cristian", "Gabriel", "Romero", LocalDate.of(1998, 4, 27), "Centre-Back", "CB", "Tottenham Hotspur", "Premier League", true),
createPlayerDTO("d5f7dd7a-1dcb-5960-ba27-e34865b63358", 19, "Nicolás", "Hernán Gonzalo", "Otamendi", LocalDate.of(1988, 2, 12), "Centre-Back", "CB", "SL Benfica", "Liga Portugal", true),
createPlayerDTO("2f6f90a0-9b9d-5023-96d2-a2aaf03143a6", 3, "Nicolás", "Alejandro", "Tagliafico", LocalDate.of(1992, 8, 31), "Left-Back", "LB", "Olympique Lyon", "Ligue 1", true),
createPlayerDTO("b5b46e79-929e-5ed2-949d-0d167109c022", 11, "Ángel", "Fabián", "Di María", LocalDate.of(1988, 2, 14), "Right Winger", "RW", "SL Benfica", "Liga Portugal", true),
createPlayerDTO("0293b282-1da8-562e-998e-83849b417a42", 7, "Rodrigo", "Javier", "de Paul", LocalDate.of(1994, 5, 24), "Central Midfield", "CM", "Atlético Madrid", "La Liga", true),
createPlayerDTO("d3ba552a-dac3-588a-b961-1ea7224017fd", 24, "Enzo", "Jeremías", "Fernández", LocalDate.of(2001, 1, 17), "Central Midfield", "CM", "SL Benfica", "Liga Portugal", true),
createPlayerDTO("9613cae9-16ab-5b54-937e-3135123b9e0d", 20, "Alexis", null, "Mac Allister",LocalDate.of(1998, 12, 24), "Central Midfield", "CM", "Brighton & Hove Albion","Premier League", true),
createPlayerDTO("acc433bf-d505-51fe-831e-45eb44c4d43c", 10, "Lionel", "Andrés", "Messi", LocalDate.of(1987, 6, 24), "Right Winger", "RW", "Paris Saint-Germain", "Ligue 1", true),
createPlayerDTO("38bae91d-8519-55a2-b30a-b9fe38849bfb", 9, "Julián", null, "Álvarez", LocalDate.of(2000, 1, 31), "Centre-Forward", "CF", "Manchester City", "Premier League", true),
// Substitutes
createPlayerDTO(uuid(12), 1, "Franco", "Daniel", "Armani", LocalDate.of(1986, 10, 16), "Goalkeeper", "GK", "River Plate", "Copa de la Liga", false),
createPlayerDTO(uuid(13), 12, "Gerónimo", null, "Rulli", LocalDate.of(1992, 5, 20), "Goalkeeper", "GK", "Ajax Amsterdam", "Eredivisie", false),
createPlayerDTO(uuid(14), 2, "Juan", "Marcos", "Foyth", LocalDate.of(1998, 1, 12), "Right-Back", "RB", "Villarreal", "La Liga", false),
createPlayerDTO(uuid(15), 4, "Gonzalo", "Ariel", "Montiel", LocalDate.of(1997, 1, 1), "Right-Back", "RB", "Nottingham Forest", "Premier League", false),
createPlayerDTO(uuid(16), 6, "Germán", "Alejo", "Pezzella", LocalDate.of(1991, 6, 27), "Centre-Back", "CB", "Real Betis Balompié", "La Liga", false),
createPlayerDTO(uuid(17), 8, "Marcos", "Javier", "Acuña", LocalDate.of(1991, 10, 28), "Left-Back", "LB", "Sevilla FC", "La Liga", false),
createPlayerDTO(uuid(18), 25, "Lisandro", null, "Martínez", LocalDate.of(1998, 1, 18), "Centre-Back", "CB", "Manchester United", "Premier League", false),
// Leandro Paredes (squad number 5) - created during tests
createPlayerDTO(uuid(19), 5, "Leandro", "Daniel", "Paredes", LocalDate.of(1994, 6, 29), "Defensive Midfield", "DM", "AS Roma", "Serie A", false),
createPlayerDTO(uuid(20), 14, "Exequiel", "Alejandro", "Palacios", LocalDate.of(1998, 10, 5), "Central Midfield", "CM", "Bayer 04 Leverkusen", "Bundesliga", false),
createPlayerDTO(uuid(21), 17, "Alejandro", "Darío", "Gómez", LocalDate.of(1988, 2, 15), "Left Winger", "LW", "AC Monza", "Serie A", false),
createPlayerDTO(uuid(22), 18, "Guido", null, "Rodríguez", LocalDate.of(1994, 4, 12), "Defensive Midfield", "DM", "Real Betis Balompié", "La Liga", false),
createPlayerDTO(uuid(23), 15, "Ángel", "Martín", "Correa", LocalDate.of(1995, 3, 9), "Right Winger", "RW", "Atlético Madrid", "La Liga", false),
createPlayerDTO(uuid(24), 16, "Thiago", "Ezequiel", "Almada", LocalDate.of(2001, 4, 26), "Attacking Midfield", "AM", "Atlanta United FC", "Major League Soccer", false),
createPlayerDTO(uuid(25), 21, "Paulo", "Exequiel", "Dybala", LocalDate.of(1993, 11, 15), "Second Striker", "SS", "AS Roma", "Serie A", false),
createPlayerDTO(uuid(26), 22, "Lautaro", "Javier", "Martínez", LocalDate.of(1997, 8, 22), "Centre-Forward", "CF", "Inter Milan", "Serie A", false));
createPlayerDTO("5a9cd988-95e6-54c1-bc34-9aa08acca8d0", 1, "Franco", "Daniel", "Armani", LocalDate.of(1986, 10, 16), "Goalkeeper", "GK", "River Plate", "Copa de la Liga", false),
createPlayerDTO("5fdb10e8-38c0-5084-9a3f-b369a960b9c2", 2, "Juan", "Marcos", "Foyth", LocalDate.of(1998, 1, 12), "Right-Back", "RB", "Villarreal", "La Liga", false),
createPlayerDTO("bbd441f7-fcfb-5834-8468-2a9004b64c8c", 4, "Gonzalo", "Ariel", "Montiel", LocalDate.of(1997, 1, 1), "Right-Back", "RB", "Nottingham Forest", "Premier League", false),
createPlayerDTO("9d140400-196f-55d8-86e1-e0b96a375c83", 5, "Leandro", "Daniel", "Paredes", LocalDate.of(1994, 6, 29), "Defensive Midfield", "DM", "AS Roma", "Serie A", false),
createPlayerDTO("d8bfea25-f189-5d5e-b3a5-ed89329b9f7c", 6, "Germán", "Alejo", "Pezzella", LocalDate.of(1991, 6, 27), "Centre-Back", "CB", "Real Betis Balompié", "La Liga", false),
createPlayerDTO("dca343a8-12e5-53d6-89a8-916b120a5ee4", 8, "Marcos", "Javier", "Acuña", LocalDate.of(1991, 10, 28), "Left-Back", "LB", "Sevilla FC", "La Liga", false),
createPlayerDTO("c62f2ac1-41e8-5d34-b073-2ba0913d0e31", 12, "Gerónimo", null, "Rulli", LocalDate.of(1992, 5, 20), "Goalkeeper", "GK", "Ajax Amsterdam", "Eredivisie", false),
createPlayerDTO("d3b0e8e8-2c34-531a-b608-b24fed0ef986", 14, "Exequiel", "Alejandro", "Palacios", LocalDate.of(1998, 10, 5), "Central Midfield", "CM", "Bayer 04 Leverkusen", "Bundesliga", false),
createPlayerDTO("b1306b7b-a3a4-5f7c-90fd-dd5bdbed57ba", 15, "Ángel", "Martín", "Correa", LocalDate.of(1995, 3, 9), "Right Winger", "RW", "Atlético Madrid", "La Liga", false),
createPlayerDTO("ecec27e8-487b-5622-b116-0855020477ed", 16, "Thiago", "Ezequiel", "Almada", LocalDate.of(2001, 4, 26), "Attacking Midfield", "AM", "Atlanta United FC", "Major League Soccer", false),
createPlayerDTO("7cc8d527-56a2-58bd-9528-2618fc139d30", 17, "Alejandro","Darío", "Gómez", LocalDate.of(1988, 2, 15), "Left Winger", "LW", "AC Monza", "Serie A", false),
createPlayerDTO("191c82af-0c51-526a-b903-c3600b61b506", 18, "Guido", null, "Rodríguez", LocalDate.of(1994, 4, 12), "Defensive Midfield", "DM", "Real Betis Balompié", "La Liga", false),
createPlayerDTO("7941cd7c-4df1-5952-97e8-1e7f5d08e8aa", 21, "Paulo", "Exequiel", "Dybala", LocalDate.of(1993, 11, 15), "Second Striker", "SS", "AS Roma", "Serie A", false),
createPlayerDTO("79c96f29-c59f-5f98-96b8-3a5946246624", 22, "Lautaro", "Javier", "Martínez", LocalDate.of(1997, 8, 22), "Centre-Forward", "CF", "Inter Milan", "Serie A", false),
createPlayerDTO("98306555-a466-5d18-804e-dc82175e697b", 25, "Lisandro", null, "Martínez", LocalDate.of(1998, 1, 18), "Centre-Back", "CB", "Manchester United", "Premier League", false));
}

private static PlayerDTO createPlayerDTO(UUID id, Integer squadNumber, String firstName, String middleName,
private static PlayerDTO createPlayerDTO(String id, Integer squadNumber, String firstName, String middleName,
String lastName, LocalDate dateOfBirth, String position, String abbrPosition,
String team, String league, Boolean starting11) {
PlayerDTO playerDTO = new PlayerDTO();
playerDTO.setId(id);
playerDTO.setId(UUID.fromString(id));
playerDTO.setSquadNumber(squadNumber);
playerDTO.setFirstName(firstName);
playerDTO.setMiddleName(middleName);
Expand Down
Loading
Loading