-
Notifications
You must be signed in to change notification settings - Fork 7
Normalize player dataset to 2022 FIFA World Cup Argentina squad (26 players) #288
Description
⚠️ Prerequisite
This issue is blocked by #268 (migrate Player PK from Long to UUID). Do not implement until #268 is merged — the data normalization (canonical UUIDs, DML seed IDs) depends on the UUID migration being in place first.
Summary
Normalize the player dataset and test fixtures to the canonical 2022 FIFA World Cup Argentina squad. This covers four areas: correcting three team/league values in the seed DML, filling the intentional ID 19 gap by seeding Leandro Paredes, aligning `PlayerFakes`/`PlayerDTOFakes` and tests to the cross-repo CRUD fixture convention (Lo Celso for Create and Delete), and updating the CHANGELOG.
Note on IDs: Once #268 lands, all integer IDs in this ticket become UUID v5 strings. The canonical UUID values for all 26 players are documented in #268. The DML corrections below should be applied using those UUIDs, not the current Long integers.
1. Data corrections in `dml.sql` (3 players)
These values reflect the squads as they were in November 2022 during the World Cup.
| Squad | Player | Field | Current (wrong) | Correct |
|---|---|---|---|---|
| 24 | Enzo Fernández | team | Chelsea FC | SL Benfica |
| 24 | Enzo Fernández | league | Premier League | Liga Portugal |
| 20 | Alexis Mac Allister | team | Liverpool FC | Brighton & Hove Albion |
| 10 | Lionel Messi | team | Inter Miami CF | Paris Saint-Germain |
| 10 | Lionel Messi | league | Major League Soccer | Ligue 1 |
Note: Ángel Di María (squad 11) already has `abbrPosition = 'RW'` — no change needed. Damián Martínez (squad 23) already has `firstName = 'Damián'` and `middleName = 'Emiliano'` — no change needed.
2. Fill the ID 19 gap — seed Leandro Paredes
`dml.sql` currently seeds 25 players (IDs 1–26 with ID 19 intentionally absent). Paredes is absent because the CREATE test inserts him at runtime and auto-generates ID 19. After this change, the CREATE fixture moves to Lo Celso (squad 27), so Paredes no longer needs to be the test fixture and should be permanently seeded.
Add the following `INSERT` to `dml.sql` at its correct sequential position (UUID from #268):
| Field | Value |
|---|---|
| id | 9d140400-196f-55d8-86e1-e0b96a375c83 (after #268) |
| firstName | Leandro |
| middleName | Daniel |
| lastName | Paredes |
| dateOfBirth | 1994-06-29 |
| squadNumber | 5 |
| position | Defensive Midfield |
| abbrPosition | DM |
| team | AS Roma |
| league | Serie A |
| starting11 | 0 |
After this insertion `dml.sql` seeds all 26 squad members. The `createAll()` methods in `PlayerFakes` and `PlayerDTOFakes` should already return 26 players; verify they include Paredes.
3. Test fixture alignment (`PlayerFakes.java` and `PlayerDTOFakes.java`)
Current fixtures vs. canonical convention:
| Operation | Current | Canonical |
|---|---|---|
| Create | Leandro Paredes (squad 5, id → 19) | Giovani Lo Celso (squad 27) |
| Retrieve | Lionel Messi (squad 10, id 10) | ✓ |
| Update | Damián Martínez (squad 23, id 1) → Emiliano | ✓ |
| Delete | Alejandro Gómez (squad 17, id 21) | Giovani Lo Celso (squad 27) |
Lo Celso was in Argentina's preliminary squad for Qatar 2022 before suffering a hamstring injury and being replaced by Almada. Squad 27 falls outside the seeded 1–26 range — a POST for him never conflicts with seeded data, and a failed cleanup leaves only a non-seeded surplus record.
Lo Celso fixture data:
| Field | Value |
|---|---|
| id | f8d13028-0d22-5513-8774-08a2332b5814 (UUID assigned after #268; null before) |
| firstName | Giovani |
| middleName | (null) |
| lastName | Lo Celso |
| dateOfBirth | 1996-07-09 |
| squadNumber | 27 |
| position | Central Midfield |
| abbrPosition | CM |
| team | Real Betis Balompié |
| league | La Liga |
| starting11 | false |
Changes to `PlayerFakes.java` and `PlayerDTOFakes.java`
- `createOneValid()`: replace Paredes (squad 5) with Lo Celso (squad 27)
- Delete fixture: replace Gómez (id 21, squad 17) with Lo Celso — see §4 for handling by test layer
4. Test layer changes
Controller tests (`PlayersControllerTests.java`) — `@WebMvcTest` with mocked service
- POST test: update `createOneValid()` call — fixture is now Lo Celso (squad 27)
- DELETE test: update mock setup to use Lo Celso fixture
No real database is involved; no ordering dependency or setup/teardown changes required.
Service tests (`PlayersServiceTests.java`) — Mockito mocks
- Create test: `createOneValid()` → Lo Celso
- Delete test: update mock `findById` calls to Lo Celso fixture
Repository tests (`PlayersRepositoryTests.java`) — `@DataJpaTest` with real SQLite
- Create test: `createOneValid()` → Lo Celso (squad 27); assert `squadNumber == 27` in saved result
- Delete test: Lo Celso is not pre-seeded, so add an inline setup step:
- `Player saved = playerRepository.save(locelso)`
- Assert `saved.getId()` is not null
- `playerRepository.deleteById(saved.getId())`
- Assert `playerRepository.findById(saved.getId()).isEmpty()`
5. Files to change
| File | Change |
|---|---|
| `src/test/resources/dml.sql` | Add Paredes (squad 5); fix Fernández/Mac Allister/Messi team/league |
| `src/test/java/.../test/PlayerFakes.java` | `createOneValid()` → Lo Celso (squad 27); update delete fixture |
| `src/test/java/.../test/PlayerDTOFakes.java` | Same changes as `PlayerFakes` |
| `src/test/java/.../controllers/PlayersControllerTests.java` | POST/DELETE fixtures → Lo Celso |
| `src/test/java/.../services/PlayersServiceTests.java` | CREATE/DELETE fixtures → Lo Celso |
| `src/test/java/.../repositories/PlayersRepositoryTests.java` | CREATE/DELETE → Lo Celso with inline save setup for DELETE |
| `CHANGELOG.md` | Add entry under `[Unreleased]` |
| `pom.xml` | Bump version |
6. CHANGELOG entry
```markdown
Changed
- Normalize player dataset: seed Paredes (squad 5) permanently, correct Fernández/Mac Allister/Messi team data
- Align CRUD test fixtures: Lo Celso (squad 27) for Create and Delete, Messi (squad 10) for Retrieve, Damián Martínez (squad 23) for Update
```
7. Version bump
Bump version in `pom.xml` following the project's versioning scheme. Apply the next alphabetical historic football club codename (current series: Arsenal → Barcelona → Chelsea → Dortmund → next starts with E).