Adding tests
[BZ-995062] add pattern to WindowDeclaration serialization
(cherry picked from commit 94873fc843b28b36a7003320ecd240cafe2ca064)
[BZ-996018] remove unnecessary cast
(cherry picked from commit 5744ff8fc246f320c4185c1101e291a7d73fe4c3)