Updated test code to avoid deprecation warning during tests