Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

added Unit Tests for application business logic#88

Merged
algotyrnt merged 10 commits intomainfrom
test
Jun 24, 2025
Merged

added Unit Tests for application business logic#88
algotyrnt merged 10 commits intomainfrom
test

Conversation

@EranTimothy-dev
Copy link
Contributor

Refactors

  • removed unnecessary comments
  • updated error message handling in shift service class methods for claim shift method

Test Cases

  • Added test cases for:
    • ShiftService.class
    • ShiftSwapService.class
    • UserService.class
    • WardService.class

@EranTimothy-dev EranTimothy-dev self-assigned this Jun 24, 2025
@EranTimothy-dev EranTimothy-dev linked an issue Jun 24, 2025 that may be closed by this pull request
@algotyrnt
Copy link
Member

This pull request includes several updates aimed at improving exception handling, logging, and testing across the LeaveService, ShiftService, and UserService classes, as well as adding comprehensive unit tests for ShiftService. The most important changes include refining exception messages, enhancing test coverage, and introducing concurrency in test execution for better performance.

Exception Handling Improvements:

  • LeaveService.java: Simplified the LeaveNotSavedException message in the reject method for better readability.
  • ShiftService.java: Replaced the lockErrorMessage variable with errorMessage for consistency, added detailed logging for DoctorCountExceededException, and improved exception messages in claimShift. [1] [2] [3]
  • UserService.java: Removed redundant try-catch block in registerUser to streamline exception handling. [1] [2]

Unit Test Enhancements:

  • LeaveServiceTest.java: Added new test cases for getLeave and reject methods to validate exception scenarios. [1] [2]
  • LeaveServiceTest.java: Introduced parallel test execution using @Execution(ExecutionMode.CONCURRENT) for improved test performance. [1] [2]
  • ShiftServiceTest.java: Added a comprehensive set of unit tests covering various scenarios, including success and failure cases for shift creation, retrieval, claiming, and deletion.

Code Quality Improvements:

  • LeaveServiceTest.java: Removed unused mock objects (testShift, testLeave, testLeaveDTO) to clean up the code.

New Test Class:

  • ShiftServiceTest.java: Introduced a new test class with extensive coverage for ShiftService, including tests for createShift, claimShift, getRoster, and more. This ensures robustness and reliability of the service layer.

@algotyrnt algotyrnt merged commit 18251ac into main Jun 24, 2025
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Write unit tests

2 participants