Skip to content

Commit 6bfcdf1

Browse files
nanotaboadaclaude
andcommitted
feat(data): normalize player dataset and align test fixtures (#288)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 42f05d0 commit 6bfcdf1

File tree

8 files changed

+152
-138
lines changed

8 files changed

+152
-138
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ Release names follow the **historic football clubs** naming convention (A–Z):
4242

4343
### Changed
4444

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

6068
### Added
6169

70+
- Repository delete test: `givenPlayerExists_whenDelete_thenPlayerIsRemoved`
71+
covers Lo Celso inline save + delete pattern (#288)
6272
- JaCoCo `check` goal added to Maven build enforcing 80% instruction and branch
6373
coverage — replaces manual HTML report step in `/pre-commit` (#268)
6474
- `.sonarcloud.properties`: SonarCloud Automatic Analysis configuration —

src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/PlayerDTOFakes.java

Lines changed: 45 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,27 @@ private PlayerDTOFakes() {
1313
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
1414
}
1515

16-
private static UUID uuid(int index) {
17-
return UUID.fromString(String.format("00000000-0000-0000-0000-%012d", index));
18-
}
19-
2016
/**
21-
* Leandro Paredes - Test data for CREATE operations
17+
* Giovani Lo Celso - Test data for CREATE and DELETE operations
2218
*
2319
* Usage:
24-
* - Service tests: Mock expected data for playersService.create()
25-
* - Controller tests: Mock expected data for POST /players
20+
* - Service tests: Mock expected data for playersService.create() / deleteBySquadNumber()
21+
* - Controller tests: Mock expected data for POST /players and DELETE /players/{squadNumber}
2622
*
27-
* Note: Not pre-seeded in test DB (squad number 5 slot is empty)
23+
* Note: Not pre-seeded in test DB (squad number 27 falls outside seeded range 1–26)
2824
*/
2925
public static PlayerDTO createOneValid() {
3026
PlayerDTO playerDTO = new PlayerDTO();
31-
playerDTO.setId(null); // Will be generated by @PrePersist
32-
playerDTO.setSquadNumber(5);
33-
playerDTO.setFirstName("Leandro");
34-
playerDTO.setMiddleName("Daniel");
35-
playerDTO.setLastName("Paredes");
36-
playerDTO.setDateOfBirth(LocalDate.of(1994, 6, 29));
37-
playerDTO.setPosition("Defensive Midfield");
38-
playerDTO.setAbbrPosition("DM");
39-
playerDTO.setTeam("AS Roma");
40-
playerDTO.setLeague("Serie A");
27+
playerDTO.setId(null); // Will be generated by GenerationType.UUID on save
28+
playerDTO.setSquadNumber(27);
29+
playerDTO.setFirstName("Giovani");
30+
playerDTO.setMiddleName(null);
31+
playerDTO.setLastName("Lo Celso");
32+
playerDTO.setDateOfBirth(LocalDate.of(1996, 7, 9));
33+
playerDTO.setPosition("Central Midfield");
34+
playerDTO.setAbbrPosition("CM");
35+
playerDTO.setTeam("Real Betis Balompié");
36+
playerDTO.setLeague("La Liga");
4137
playerDTO.setStarting11(false);
4238
return playerDTO;
4339
}
@@ -51,7 +47,7 @@ public static PlayerDTO createOneValid() {
5147
*/
5248
public static PlayerDTO createOneForUpdate() {
5349
PlayerDTO playerDTO = new PlayerDTO();
54-
playerDTO.setId(uuid(1));
50+
playerDTO.setId(UUID.fromString("01772c59-43f0-5d85-b913-c78e4e281452"));
5551
playerDTO.setSquadNumber(23);
5652
playerDTO.setFirstName("Damián");
5753
playerDTO.setMiddleName("Emiliano");
@@ -74,7 +70,7 @@ public static PlayerDTO createOneForUpdate() {
7470
*/
7571
public static PlayerDTO createOneUpdated() {
7672
PlayerDTO playerDTO = new PlayerDTO();
77-
playerDTO.setId(uuid(1));
73+
playerDTO.setId(UUID.fromString("01772c59-43f0-5d85-b913-c78e4e281452"));
7874
playerDTO.setSquadNumber(23);
7975
playerDTO.setFirstName("Emiliano");
8076
playerDTO.setMiddleName(null);
@@ -110,46 +106,45 @@ public static PlayerDTO createOneInvalid() {
110106
}
111107

112108
/**
113-
* ALL 26 players - Complete Argentina 2022 FIFA World Cup squad
109+
* ALL 26 players - Complete Argentina 2022 FIFA World Cup squad (squads 1–26)
114110
*/
115111
public static List<PlayerDTO> createAll() {
116112
return Arrays.asList(
117113
// Starting 11
118-
createPlayerDTO(uuid(1), 23, "Damián", "Emiliano", "Martínez", LocalDate.of(1992, 9, 2), "Goalkeeper", "GK", "Aston Villa FC", "Premier League", true),
119-
createPlayerDTO(uuid(2), 26, "Nahuel", null, "Molina", LocalDate.of(1998, 4, 6), "Right-Back", "RB", "Atlético Madrid", "La Liga", true),
120-
createPlayerDTO(uuid(3), 13, "Cristian", "Gabriel", "Romero", LocalDate.of(1998, 4, 27), "Centre-Back", "CB", "Tottenham Hotspur", "Premier League", true),
121-
createPlayerDTO(uuid(4), 19, "Nicolás", "Hernán Gonzalo", "Otamendi", LocalDate.of(1988, 2, 12), "Centre-Back", "CB", "SL Benfica", "Liga Portugal", true),
122-
createPlayerDTO(uuid(5), 3, "Nicolás", "Alejandro", "Tagliafico", LocalDate.of(1992, 8, 31), "Left-Back", "LB", "Olympique Lyon", "Ligue 1", true),
123-
createPlayerDTO(uuid(6), 11, "Ángel", "Fabián", "Di María", LocalDate.of(1988, 2, 14), "Right Winger", "RW", "SL Benfica", "Liga Portugal", true),
124-
createPlayerDTO(uuid(7), 7, "Rodrigo", "Javier", "de Paul", LocalDate.of(1994, 5, 24), "Central Midfield", "CM", "Atlético Madrid", "La Liga", true),
125-
createPlayerDTO(uuid(8), 24, "Enzo", "Jeremías", "Fernández", LocalDate.of(2001, 1, 17), "Central Midfield", "CM", "Chelsea FC", "Premier League", true),
126-
createPlayerDTO(uuid(9), 20, "Alexis", null, "Mac Allister", LocalDate.of(1998, 12, 24), "Central Midfield", "CM", "Liverpool FC", "Premier League", true),
127-
createPlayerDTO(uuid(10), 10, "Lionel", "Andrés", "Messi", LocalDate.of(1987, 6, 24), "Right Winger", "RW", "Inter Miami CF", "Major League Soccer", true),
128-
createPlayerDTO(uuid(11), 9, "Julián", null, "Álvarez", LocalDate.of(2000, 1, 31), "Centre-Forward", "CF", "Manchester City", "Premier League", true),
114+
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),
115+
createPlayerDTO("da31293b-4c7e-5e0f-a168-469ee29ecbc4", 26, "Nahuel", null, "Molina", LocalDate.of(1998, 4, 6), "Right-Back", "RB", "Atlético Madrid", "La Liga", true),
116+
createPlayerDTO("c096c69e-762b-5281-9290-bb9c167a24a0", 13, "Cristian", "Gabriel", "Romero", LocalDate.of(1998, 4, 27), "Centre-Back", "CB", "Tottenham Hotspur", "Premier League", true),
117+
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),
118+
createPlayerDTO("2f6f90a0-9b9d-5023-96d2-a2aaf03143a6", 3, "Nicolás", "Alejandro", "Tagliafico", LocalDate.of(1992, 8, 31), "Left-Back", "LB", "Olympique Lyon", "Ligue 1", true),
119+
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),
120+
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),
121+
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),
122+
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),
123+
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),
124+
createPlayerDTO("38bae91d-8519-55a2-b30a-b9fe38849bfb", 9, "Julián", null, "Álvarez", LocalDate.of(2000, 1, 31), "Centre-Forward", "CF", "Manchester City", "Premier League", true),
129125
// Substitutes
130-
createPlayerDTO(uuid(12), 1, "Franco", "Daniel", "Armani", LocalDate.of(1986, 10, 16), "Goalkeeper", "GK", "River Plate", "Copa de la Liga", false),
131-
createPlayerDTO(uuid(13), 12, "Gerónimo", null, "Rulli", LocalDate.of(1992, 5, 20), "Goalkeeper", "GK", "Ajax Amsterdam", "Eredivisie", false),
132-
createPlayerDTO(uuid(14), 2, "Juan", "Marcos", "Foyth", LocalDate.of(1998, 1, 12), "Right-Back", "RB", "Villarreal", "La Liga", false),
133-
createPlayerDTO(uuid(15), 4, "Gonzalo", "Ariel", "Montiel", LocalDate.of(1997, 1, 1), "Right-Back", "RB", "Nottingham Forest", "Premier League", false),
134-
createPlayerDTO(uuid(16), 6, "Germán", "Alejo", "Pezzella", LocalDate.of(1991, 6, 27), "Centre-Back", "CB", "Real Betis Balompié", "La Liga", false),
135-
createPlayerDTO(uuid(17), 8, "Marcos", "Javier", "Acuña", LocalDate.of(1991, 10, 28), "Left-Back", "LB", "Sevilla FC", "La Liga", false),
136-
createPlayerDTO(uuid(18), 25, "Lisandro", null, "Martínez", LocalDate.of(1998, 1, 18), "Centre-Back", "CB", "Manchester United", "Premier League", false),
137-
// Leandro Paredes (squad number 5) - created during tests
138-
createPlayerDTO(uuid(19), 5, "Leandro", "Daniel", "Paredes", LocalDate.of(1994, 6, 29), "Defensive Midfield", "DM", "AS Roma", "Serie A", false),
139-
createPlayerDTO(uuid(20), 14, "Exequiel", "Alejandro", "Palacios", LocalDate.of(1998, 10, 5), "Central Midfield", "CM", "Bayer 04 Leverkusen", "Bundesliga", false),
140-
createPlayerDTO(uuid(21), 17, "Alejandro", "Darío", "Gómez", LocalDate.of(1988, 2, 15), "Left Winger", "LW", "AC Monza", "Serie A", false),
141-
createPlayerDTO(uuid(22), 18, "Guido", null, "Rodríguez", LocalDate.of(1994, 4, 12), "Defensive Midfield", "DM", "Real Betis Balompié", "La Liga", false),
142-
createPlayerDTO(uuid(23), 15, "Ángel", "Martín", "Correa", LocalDate.of(1995, 3, 9), "Right Winger", "RW", "Atlético Madrid", "La Liga", false),
143-
createPlayerDTO(uuid(24), 16, "Thiago", "Ezequiel", "Almada", LocalDate.of(2001, 4, 26), "Attacking Midfield", "AM", "Atlanta United FC", "Major League Soccer", false),
144-
createPlayerDTO(uuid(25), 21, "Paulo", "Exequiel", "Dybala", LocalDate.of(1993, 11, 15), "Second Striker", "SS", "AS Roma", "Serie A", false),
145-
createPlayerDTO(uuid(26), 22, "Lautaro", "Javier", "Martínez", LocalDate.of(1997, 8, 22), "Centre-Forward", "CF", "Inter Milan", "Serie A", false));
126+
createPlayerDTO("5a9cd988-95e6-54c1-bc34-9aa08acca8d0", 1, "Franco", "Daniel", "Armani", LocalDate.of(1986, 10, 16), "Goalkeeper", "GK", "River Plate", "Copa de la Liga", false),
127+
createPlayerDTO("5fdb10e8-38c0-5084-9a3f-b369a960b9c2", 2, "Juan", "Marcos", "Foyth", LocalDate.of(1998, 1, 12), "Right-Back", "RB", "Villarreal", "La Liga", false),
128+
createPlayerDTO("bbd441f7-fcfb-5834-8468-2a9004b64c8c", 4, "Gonzalo", "Ariel", "Montiel", LocalDate.of(1997, 1, 1), "Right-Back", "RB", "Nottingham Forest", "Premier League", false),
129+
createPlayerDTO("9d140400-196f-55d8-86e1-e0b96a375c83", 5, "Leandro", "Daniel", "Paredes", LocalDate.of(1994, 6, 29), "Defensive Midfield", "DM", "AS Roma", "Serie A", false),
130+
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),
131+
createPlayerDTO("dca343a8-12e5-53d6-89a8-916b120a5ee4", 8, "Marcos", "Javier", "Acuña", LocalDate.of(1991, 10, 28), "Left-Back", "LB", "Sevilla FC", "La Liga", false),
132+
createPlayerDTO("c62f2ac1-41e8-5d34-b073-2ba0913d0e31", 12, "Gerónimo", null, "Rulli", LocalDate.of(1992, 5, 20), "Goalkeeper", "GK", "Ajax Amsterdam", "Eredivisie", false),
133+
createPlayerDTO("d3b0e8e8-2c34-531a-b608-b24fed0ef986", 14, "Exequiel", "Alejandro", "Palacios", LocalDate.of(1998, 10, 5), "Central Midfield", "CM", "Bayer 04 Leverkusen", "Bundesliga", false),
134+
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),
135+
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),
136+
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),
137+
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),
138+
createPlayerDTO("7941cd7c-4df1-5952-97e8-1e7f5d08e8aa", 21, "Paulo", "Exequiel", "Dybala", LocalDate.of(1993, 11, 15), "Second Striker", "SS", "AS Roma", "Serie A", false),
139+
createPlayerDTO("79c96f29-c59f-5f98-96b8-3a5946246624", 22, "Lautaro", "Javier", "Martínez", LocalDate.of(1997, 8, 22), "Centre-Forward", "CF", "Inter Milan", "Serie A", false),
140+
createPlayerDTO("98306555-a466-5d18-804e-dc82175e697b", 25, "Lisandro", null, "Martínez", LocalDate.of(1998, 1, 18), "Centre-Back", "CB", "Manchester United", "Premier League", false));
146141
}
147142

148-
private static PlayerDTO createPlayerDTO(UUID id, Integer squadNumber, String firstName, String middleName,
143+
private static PlayerDTO createPlayerDTO(String id, Integer squadNumber, String firstName, String middleName,
149144
String lastName, LocalDate dateOfBirth, String position, String abbrPosition,
150145
String team, String league, Boolean starting11) {
151146
PlayerDTO playerDTO = new PlayerDTO();
152-
playerDTO.setId(id);
147+
playerDTO.setId(UUID.fromString(id));
153148
playerDTO.setSquadNumber(squadNumber);
154149
playerDTO.setFirstName(firstName);
155150
playerDTO.setMiddleName(middleName);

0 commit comments

Comments
 (0)