Fix deprecation warning in a unit test