[Core] Fix mock and stub deprecations.