FINERACT-2533: Add comprehensive unit tests for SavingsAccountDomainS…#5623
FINERACT-2533: Add comprehensive unit tests for SavingsAccountDomainS…#5623awaneetdecoder wants to merge 1 commit intoapache:developfrom
Conversation
717a42e to
97d6ff6
Compare
8d344c8 to
6004637
Compare
There was a problem hiding this comment.
@awaneetdecoder Can you help me understand these mocked situations how help the test coverage?
|
Hi @adamsaghy, thank you for the feedback. Keep the tests that verify real orchestration — backdated interest recalculation, journal entries, reversal repository save. Which approach aligns best with the project's testing standards for this module? |
In my opinion probably integration tests or event better E2E test coverage would be the best. E2E testing is doing no mocking at all, but rather tests scenarios like: customer opens a savings account, deposit some amount, withdraw later, etc. Alongside it checks whether these steps were executed and the result is correct and additional scenarios can cover what happens if user tries to withdraw more than available, etc. If you are interested in writing E2E tests for savings account related actions, you can take a look at |
|
Hi @adamsaghy, thank you for the clear guidance!
Thank you for pointing me in the right direction! |
|
Hi @adamsaghy, thank you for the clear guidance! As suggested, I have closed this PR and opened a new one with proper The new PR covers:
New PR: #5646 The implementation follows the existing patterns in SavingsAccountStepDef.java:
Thank you for pointing me in the right direction! |
Currently, SavingsAccountDomainServiceJpa lacks comprehensive unit tests for its core domain logic. This PR adds a JUnit 5 test suite covering 15 scenarios, including critical edge cases such as:
Insufficient funds during withdrawal.
Transactions on inactive/blocked accounts.
Interest recalculation for backdated transactions.
Hold/Lien amount transaction processing.