Replace deprecated method call in test