我将junit
版本改为4.11并得到:
[WARNING] [deprecation] Assert in junit.framework has been deprecated
[WARNING] [deprecation] Assert in junit.framework has been deprecated
....
如何迁移?
因为看起来Assert类已经从Qazxswpoi移到了JUnit 4.0中的junit.framework
- 你可以使用它,而不是弃用它。
从中更改您的import语句
org.junit.Assert
至
import junit.framework.Assert;
这将纠正您的JUnit弃用警告。
仅供参考:您可以在apiwave(import org.junit.Assert;
)上自动检查,并查看junit.framework.Assert的替换是org.junit.Assert
我们进行了大量的测试并且有很多断言。
添加类似的东西
http://apiwave.com/java/api/junit.framework.Assert
对import语句也有助于限制测试代码的变化。