ben*_*ben 31 java junit hamcrest
我很困惑.目前我正在测试我的弹簧应用程序
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
只要我想匹配RegularExpressions,我就很开心.在hamcrest 1.3中你需要编写自己的匹配器,我不喜欢这么多.我搜索并发现hamcrest 2.0内置了一些内容,例如:
assertThat(DateHelper.getActualDateForXML(), MatchesPattern.matchesPattern("\\d{4}+-\\d{2}-+\\d{2}+T\\d{2}+:\\d{2}+:\\d{2}+"));
Run Code Online (Sandbox Code Playgroud)
我很高兴,我补充说:
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-junit</artifactId>
<version>2.0.0.0</version>
<scope>test</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
并从spring-boot-starter-test中踢出了1.3个hamcrest依赖项:
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
</exclusion>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
Run Code Online (Sandbox Code Playgroud)
现在一切都在按照我的预期工作,但我觉得不舒服.因为我可以找到写大约1.3的人,并且无法真正找到使用hamcrest-junit 2.0.
有人可以解释一下他们之间的联系吗?因为看起来hamcrest-junit 2.0的所有内容都来自hamcrest 1.3 ......
谢谢Ben
Ivo*_*ori 36
基于Hamcrest Github
我接受了
=>在这种情况下,我认为对于Hamcrest家伙来说,等待/协调JUnit 5项目然后大幅前进是明智的.
正如@heenenee所提到的那样,这些家伙忙于处理其他事情,所以这个项目并没有多少发生.
回答
有人可以解释一下他们之间的联系吗?因为看起来hamcrest-junit 2.0的所有内容都来自hamcrest 1.3
......但我感觉不舒服.因为我可以找到写大约1.3的人,并且无法真正找到使用hamcrest-junit 2.0.
目前,除了你的情况,没有太大的动力转移到hamcrest-junit 2.0.一旦Junit 5发布,我预计会有更多的动力再次前进.
| 归档时间: |
|
| 查看次数: |
6023 次 |
| 最近记录: |