Refactoring of apply tests