JUnit学习要点记录
1.import static org.junit.Assert.*;是j2se 5.0出现的引入类下面的所有static方法,以便在程序中直接使用方法名即可调用
2. 在JUnit4中增加类似于 assertTrue(String message, Object excepted), 在不满足excepted条件时,输出message消息
3.配合Hamcrest使用,Hamcrest是一个书写匹配器对象时允许直接定义匹配规则的框架.有大量的匹配器是侵入式的
4.常用annotation
@Ignore 被忽略的测试方法
@Before 每一个测试方法之前运行
@After 每一个测试方法之后运行
@BeforeClass 所有测试开始之前运行 必须是static
@AfterClass 所有测试结束之后运行 必须是static