Skip to content

Conversation

@manoja-ss
Copy link
Contributor

Summary

  • Added Mockito-based unit tests for DashboardController
  • Removed deprecated @MockBean usage
  • Refactored tests to avoid loading the full Spring application context
  • Disabled contextLoads test to avoid requiring database configuration during unit tests
  • Added Mockito inline mock maker configuration to prevent runtime warnings

Linked issue

Closes #158

How to test

  1. Run mvn test
  2. Verify DashboardControllerTest passes
  3. Ensure the build completes with BUILD SUCCESS

Notes / Risk

  • No production code changes
  • Test-only changes
  • Low risk

- Added Mockito-based unit tests for DashboardController
- Removed deprecated @MockBean usage
- Disabled contextLoads test due to missing DB configuration
- Added Mockito inline mock maker configuration
@DenizAltunkapan
Copy link
Member

@manoja-ss please format your code using spotless

@manoja-ss
Copy link
Contributor Author

Hi @DenizAltunkapan,
I’ve formatted the code using Spotless and pushed the update.
Please review when you have time. Thanks!

@DenizAltunkapan
Copy link
Member

Hi @manoja-ss ,
Currently the CI skips all tests via -DskipTests.
I’d strongly suggest removing this flag in .github/workflows/backend.yml so that unit tests are executed in the workflow as well. After that, we should be able to merge. Thank you very much.

@manoja-ss
Copy link
Contributor Author

Hi @DenizAltunkapan,
I’ve removed the -DskipTests flag so unit tests now run as part of the backend CI workflow.
Please let me know if anything else is needed. Thanks!

@DenizAltunkapan DenizAltunkapan merged commit 6b67831 into Vault-Web:main Jan 5, 2026
2 checks passed
@manoja-ss manoja-ss deleted the DashboardControllerTest branch January 7, 2026 05:31
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.

Add unit test for DashboardController

2 participants