Commit 0f4ca43
fix: address PR review feedback for password history and tests
- Fix password history off-by-one error in cleanUpPasswordHistory()
- Keep historyCount + 1 entries to ensure proper password reuse prevention
- With historyCount=3, now keeps [current, prev1, prev2, prev3]
- Prevents immediate reuse of the Nth previous password
- Fix UserAPIUnitTest NPE from unstubbed PasswordPolicyService mock
- Add stub to return empty list (no validation errors) for all registration tests
- Add Collections import for the stub return value
- Ensures tests don't fail with NullPointerException on .isEmpty() call
These changes address critical issues identified in code review:
1. Password history was only preventing reuse of historyCount-1 passwords
2. Unit tests were failing due to unstubbed mock returning null
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 90c8feb commit 0f4ca43
2 files changed
Lines changed: 14 additions & 2 deletions
File tree
- src
- main/java/com/digitalsanctuary/spring/user/service
- test/java/com/digitalsanctuary/spring/user/api
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | | - | |
312 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
313 | 316 | | |
314 | 317 | | |
315 | 318 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
| 147 | + | |
| 148 | + | |
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
| |||
182 | 185 | | |
183 | 186 | | |
184 | 187 | | |
| 188 | + | |
| 189 | + | |
185 | 190 | | |
186 | 191 | | |
187 | 192 | | |
| |||
202 | 207 | | |
203 | 208 | | |
204 | 209 | | |
| 210 | + | |
| 211 | + | |
205 | 212 | | |
206 | 213 | | |
207 | 214 | | |
| |||
252 | 259 | | |
253 | 260 | | |
254 | 261 | | |
| 262 | + | |
| 263 | + | |
255 | 264 | | |
256 | 265 | | |
257 | 266 | | |
| |||
0 commit comments