Junit in action 第二版的例子中使用 Hamcrest 存在问题,应该是版本的问题,修改如下:
import static org.junit.Assert.assertTrue;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.matchers.JUnitMatchers.hasItem;
实验成功
PS. 我的junit版本是4.11
import static org.junit.Assert.assertTrue;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.matchers.JUnitMatchers.hasItem;
实验成功
PS. 我的junit版本是4.11
本文详细阐述了在JUnitinaction第二版的示例中遇到的使用Hamcrest的问题,并提供了修复建议。重点是通过版本更新解决了代码运行失败的问题,实验最终成功。此外,文章还强调了正确理解和使用测试框架的重要性。

6561

被折叠的 条评论
为什么被折叠?



