Skip to content

Conversation

@vizahat36
Copy link
Contributor

Related to #109

This pull request adds comprehensive unit tests for the Chat Management service layer, improving coverage of chat-related business logic and critical edge cases.

What was added:

  • ChatServiceTest: covers saving group and private messages, sender validation, and encryption/decryption logic
  • PrivateChatServiceTest: covers retrieving existing chats (both directions), creating new chats, and user-not-found edge cases

Coverage summary:

  • Chat management: create, retrieve, and validate chat messages
  • Edge cases: missing users and existing chat detection
  • Tests use JUnit 5 and Mockito
  • All tests are isolated, fast, and do not depend on DB or network

Notes:

  • User management tests were added in a previous PR
  • Group management tests will be handled separately

Test verification:

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

Test Output

Copilot AI review requested due to automatic review settings January 21, 2026 19:11
@vizahat36
Copy link
Contributor Author

@DenizAltunkapan
This PR is intentionally scoped to Chat Management unit tests in alignment with Issue #109.
User management was addressed in a prior PR, and group management tests will be submitted separately.

Please let me know if any additional coverage or refinements are required.

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 pull request adds comprehensive unit tests for the Chat Management service layer, specifically for ChatService and PrivateChatService. The tests improve coverage of chat-related business logic including message saving, encryption/decryption, and private chat retrieval/creation.

Changes:

  • Added ChatServiceTest with 10 test methods covering message saving, encryption/decryption, and various error scenarios
  • Added PrivateChatServiceTest with 5 test methods covering private chat retrieval, creation, and user validation
  • Tests use JUnit 5 and Mockito for isolated, fast unit testing without database dependencies

Reviewed changes

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

File Description
backend/src/test/java/vaultWeb/services/ChatServiceTest.java Comprehensive tests for ChatService covering group/private message saving, sender validation, encryption/decryption logic, and error handling
backend/src/test/java/vaultWeb/services/PrivateChatServiceTest.java Tests for PrivateChatService covering bidirectional chat lookup, creation, and user not found scenarios

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

Copy link
Member

@DenizAltunkapan DenizAltunkapan left a comment

Choose a reason for hiding this comment

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

good job, as always thank you! @vizahat36

@DenizAltunkapan DenizAltunkapan merged commit 7f6cc8b into Vault-Web:main Jan 22, 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