π― Goal
Add unit tests for VetService to ensure business logic, validation rules, and error handling work correctly.
π¦ Scope
πΉ createVet()
Test the following scenarios:
- β
Should create vet successfully when valid input
- β Should throw ResourceNotFoundException when user does not exist
- β Should throw BusinessRuleException when licenseId already exists
- β Should throw BusinessRuleException when user is already registered as vet
- β
Should update user role to VET if not already set
- β Should handle DataIntegrityViolationException and convert to BusinessRuleException
πΉ getAllVets()
- β
Should return list of all vets
- β
Should map Vet entities to VetResponse
πΉ getVetById(UUID id)
- β
Should return vet when found
- β Should throw ResourceNotFoundException when vet does not exist
π§ͺ Technical Notes
- Use Mockito for mocking dependencies (VetRepository, UserRepository)
- Use @ExtendWith(MockitoExtension.class)
- Do NOT use Spring context (pure unit tests)
- Verify interactions with repositories where relevant
β
Definition of Done
- All scenarios covered with unit tests
- Tests are isolated (no DB, no SpringBootTest)
- All tests pass locally and in CI
- Code follows project test conventions
π― Goal
Add unit tests for VetService to ensure business logic, validation rules, and error handling work correctly.
π¦ Scope
πΉ createVet()
Test the following scenarios:
πΉ getAllVets()
πΉ getVetById(UUID id)
π§ͺ Technical Notes
β Definition of Done