adamsaghy commented on PR #5623:
URL: https://github.com/apache/fineract/pull/5623#issuecomment-4069432690

   > Hi @adamsaghy, thank you for the feedback. You are absolutely right — the 
current tests focus more on behavioral verification (ensuring the service 
orchestrates calls to repositories, recalculates interest on backdated entries, 
and triggers journal entries) rather than state-based verification of the 
SavingsAccount balance logic itself. I used mock(SavingsAccount.class) to 
isolate SavingsAccountDomainServiceJpa from the complex internal state of the 
JPA entity, which is difficult to instantiate correctly in a pure unit test 
without a persistence context. My proposal to improve this:
   > 
   > Keep the tests that verify real orchestration — backdated interest 
recalculation, journal entries, reversal repository save. Remove or refactor 
the weak tests that only verify mocked exception throwing. If the project 
prefers integration tests for this service to exercise full JPA/entity logic, 
please point me to a preferred base class (like AbstractIntegrationTest) and I 
will rewrite accordingly.
   > 
   > 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 
`fineract-e2e-tests-runner/src/test/resources/features/SavingsAccount.feature`. 
The logic and test cases can be found under `fineract-e2e-tests-runner` and 
`fineract-e2e-tests-core` modules. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to