JUnit
共 1 篇文章
JUnit中使用Hamcrest测试框架的assertThat断言
JUnit中使用Hamcrest测试框架的assertThat断言【4.4新特性】 1.JUnit4.4引入了Hamcrest框架,Hamcest提供了一套匹配符Matcher,这些匹配符更接近自然语言,可读性高,更加灵活; 2.使用全新的断言语法:assertThat,结合Hamcest提供的匹配符,只用这一个方法,就可以实现所有的测试; 3.assertThat语法如下: assertThat(T actual, Matcher matcher); assertThat(String reason, T actual, Matcher matcher); 其中actual为需要测试的变量…
2010-10-30 10:58 · JUnit · junit · D语言 · 框架