I am quite confused. Currently I am testing my spring application using
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
I was happy as long as I wanted to match RegularExpressions. In hamcrest 1.3 you need to write your own matcher, which I did not like that much. I searched and found that hamcrest 2.0 has something build in, like:
assertThat(DateHelper.getActualDateForXML(), MatchesPattern.matchesPattern("\\d{4}+-\\d{2}-+\\d{2}+T\\d{2}+:\\d{2}+:\\d{2}+"));
I was happy, I added:
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-junit</artifactId>
<version>2.0.0.0</version>
<scope>test</scope>
</dependency>
And kicked out the 1.3 hamcrest dependencies from spring-boot-starter-test:
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
</exclusion>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
Now everything is still working as I expect it to work, but I do not feel really comfortable. Because I can just find people writing about 1.3 and can not really find the use of hamcrest-junit 2.0.
Can somebody explain me the connection between them? Because it seems that hamcrest-junit 2.0 has everything build in from hamcrest 1.3...
Thanks Ben