Skip to content

Commit a0bd0b1

Browse files
committed
refactor(tests): remove magic number and use recursive comparison
- Replace hard-coded hasSize(7) with hasSize(expected.size()) - Replace partial assertions with full recursive comparison - Improves test robustness in league search test
1 parent c855478 commit a0bd0b1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/services/PlayersServiceTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,9 @@ void givenPlayersExist_whenSearchByLeague_thenReturns7Players() {
293293
// Then
294294
verify(playersRepositoryMock, times(1)).findByLeagueContainingIgnoreCase(any());
295295
then(actual)
296-
.hasSize(7)
297-
.allSatisfy(dto -> then(dto.getLeague()).contains(league));
296+
.hasSize(expected.size())
297+
.usingRecursiveComparison()
298+
.isEqualTo(expected);
298299
}
299300

300301
/**

0 commit comments

Comments
 (0)