KamoCRM

Cover the chat-routing propagation that broke assignLoanOfficer

TestSecurityService
Shipped
6 ஆகஸ்ட், 2026 அன்று 8:56 PM UTC
Author
Kamo
Commit
1e59b9f

assignLoanOfficer gained a step that looks up the loan's source lead to reroute the borrower's open public-chat session. That lookup runs a JPQL query through the service's EntityManager, which is @PersistenceContext field-injected and so absent from the constructor this unit test builds the service with — the test NPE'd on a null em from the moment the branch landed, untested. Wire em the way Spring does and cover the branch itself: routes to the new officer for a portal-sourced loan, publishes nothing for a hand-entered loan with no source lead, and publishes nothing when the assignment is cleared.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing