[build] Fixed failing tests.
- Also replaced util deprecate methods usage.

(cherry picked from commit c857629ed4298582f8b1d13dda199b0622e61b70)