Sono abbastanza confuso. Attualmente sto testando la mia domanda molla conHamcrest: quale versione usare? 1.3 o 2
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
ero felice fino a quando ho voluto abbinare RegularExpressions. In hamcrest 1.3 è necessario scrivere il proprio matcher, cosa che non mi è piaciuta molto. Ho cercato e trovato che hamcrest 2.0 ha qualcosa a costruire in, come:
assertThat(DateHelper.getActualDateForXML(), MatchesPattern.matchesPattern("\\d{4}+-\\d{2}-+\\d{2}+T\\d{2}+:\\d{2}+:\\d{2}+"));
ero felice, ho aggiunto:
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-junit</artifactId>
<version>2.0.0.0</version>
<scope>test</scope>
</dependency>
e preso a calci i 1,3 dipendenze hamcrest dalla primavera-boot-starter- test:
Ora tutto funziona ancora come mi aspetto che funzioni, ma non mi sento davvero a mio agio. Perché posso trovare persone che scrivono sulla 1.3 e non riescono a trovare l'uso di hamcrest-junit 2.0.
Qualcuno può spiegarmi la connessione tra loro? Perché sembra che hamcrest-JUnit 2.0 ha tutto costruito in da hamcrest 1.3 ...
Grazie Ben
Non è possibile trovare documentazione sulla differenza tra 2.0 e 1.3 perché il progetto [non è stato gestito correttamente per diversi mesi] [1]. Se un committer attivo prende il sopravvento, lo sapremo tutti. Grazie a @CoronA. – heenenee
Correlati: [Snippet su come configurare in modo efficace Junit con hamcrest] (http://acdcjunior.github.io/java-unit-tests-maven-dependencies-junit-hamcrest-mockito.html) – acdcjunior