现在的位置: 首页 > 综合 > 正文

junit.framework.Assert 与org.junit.Assert

2018年04月07日 ⁄ 综合 ⁄ 共 519字 ⁄ 字号 评论关闭

differences
between 2 JUnit Assert classes

The old method (of Junit 3) was to mark the test-classes by extending junit.framework.TestCase. That inherited junit.framework.Assert itself and your test-class gained the ability to call the assert-methods this way.

Since version 4 of junit the framework uses Annotations for marking tests. So you no longer need to extend TestCase. But that means, the assert-methods aren't available. But you can make a static import of the new Assert-class. That's why all the
assert-methods in the new class are static methods. So you can import it this way:

Junit相关文章:

全面认识JUnit4.0

抱歉!评论已关闭.