Suppose I have a library, which contains both a deprecated function and a preferred function:
object MyLib {
def preferredFunction() = ()
@deprecated("Use preferredFunction instead", "1.0") def deprecatedFunction() = ()
}
I want to test both preferredFunction
and deprecatedFunction
in ScalaTest:
class MyLibSpec extends FreeSpec with Matchers {
"preferred function" in {
MyLib.preferredFunction() should be(())
}
"deprecated function" in {
MyLib.deprecatedFunction() should be(())
}
}
However, a deprecation warning is reported at MyLib.deprecatedFunction()
.
How to avoid the warning?