Files
iot-dc3/dc3-common
Vickey afaa899c19 test(auth): cover security-critical service impls with mockito
Add Mockito-based unit tests for the four ServiceImpl classes that the
TokenServiceImpl pipeline transitively trusts. Other ServiceImpls in
dc3-common-auth follow the same MyBatis-Plus CRUD shape and will be
covered as Testcontainers PG slice tests in a later stage where the
real schema can validate the lambda query wrappers end-to-end.

- TenantServiceImplTest (16): save / remove / update / selectById /
  selectByCode / selectByPage. Covers DuplicateException on save,
  NotFoundException on remove and update, AddException / DeleteException
  / UpdateException when the manager returns false, the same-row
  duplicate check during update, and Pages defaulting / preservation.
- UserLoginServiceImplTest (12): the standard CRUD trio plus the four
  selectByLoginName branches (blank + throw / blank + silent /
  not-found + throw / happy path) and the three checkLoginNameValid
  outcomes (unknown / disabled / enabled).
- UserPasswordServiceImplTest (9): the CRUD trio plus the password
  hashing assertion via DecodeUtil.md5 (save and update both rehash
  before persistence). Reset-password is asserted to set
  AlgorithmConstant.DEFAULT_PASSWORD before delegating to update.
- TenantBindServiceImplTest (8): CRUD trio plus the
  selectByTenantIdAndUserId branches and the null-id short circuit on
  listUserIdsByTenantId. The happy path of listUserIdsByTenantId
  requires mybatis-plus lambda metadata not available without a real
  ORM context and is deferred to the slice test stage.

Verified locally: 45 new cases green; dc3-common-auth now ships 69
unit tests across biz + service tiers.
2026-05-13 16:01:22 +08:00
..