LPS-32500 Encapsulate test logic (no changes, only refactorization)