Patch for test

This patches improve tests.
These are not necessary soon but would be needed when we bump core to later versions.
Oh, I'd quite forgotten such solution...

OK, I will do it. Maybe some methods including this would be moved to new Util class.