BS-8590: Add tests for refactoring in Pattern Expression