Remove deprecation warnings in JUnit tests.