Skip to content

Conversation

@vizahat36
Copy link
Contributor

@vizahat36 vizahat36 commented Jan 20, 2026

Related to #109

This PR adds missing unit tests for the User Management service layer.

What was added:

  • UserServiceTest: covers registration, username checks, user listing, and password change logic
  • AuthServiceTest: covers authentication/login success and failure cases

Notes:

  • Controller tests already existed and were not modified
  • Tests are written with JUnit 5 and Mockito
  • All tests are fast, isolated, and do not depend on DB or network

Test verification:

  • ./mvnw test passes successfully (27 tests, 0 failures)

Test output

Copilot AI review requested due to automatic review settings January 20, 2026 14:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive unit tests for the UserService and AuthService classes to improve test coverage of the service layer. The tests use JUnit 5 and Mockito for isolated, fast testing without external dependencies.

Changes:

  • Added UserServiceTest with 7 test cases covering user registration, username validation, user listing, and password changes
  • Added AuthServiceTest with 3 test cases covering login success and failure scenarios
  • All tests follow existing project patterns and use proper mocking with MockitoExtension

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
backend/src/test/java/vaultWeb/services/auth/AuthServiceTest.java Adds unit tests for AuthService login functionality with success and failure cases
backend/src/test/java/vaultWeb/services/UserServiceTest.java Adds comprehensive unit tests for UserService covering registration, username checks, user listing, and password management

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vizahat36
Copy link
Contributor Author

@DenizAltunkapan whenever you have time, could you please take a look at this PR? Thank you.

For clarity: user roles in the current codebase are applied at the group/member domain level and not within the UserService or AuthService logic. This PR focuses on unit testing the user lifecycle and authentication flow, which aligns with the scope of Issue #109.

@DenizAltunkapan
Copy link
Member

@vizahat36 please format your code using spotless

@vizahat36
Copy link
Contributor Author

@DenizAltunkapan
Thanks for the heads-up! I’ve applied Spotless formatting and pushed an update. Please let me know if anything else is needed.

@DenizAltunkapan
Copy link
Member

DenizAltunkapan commented Jan 21, 2026

@vizahat36 Thank you for your contribution. I changed the keyword from “fixes” to “related to” so the issue stays open and others can open follow-up PRs for testing purposes.

@DenizAltunkapan DenizAltunkapan merged commit b7555cb into Vault-Web:main Jan 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants