跑步
assertThat(collection, allOf(hasItems(i1, i2, i3), hasSize(3)));
从 Eclipse (Run as -> Junit) 一切正常,但是当我执行 Maven 测试 ( ) 时,它在阶段mvn clean test
失败,解释如下test-compile
[ERROR] The method allOf(Matcher<? super T>, Matcher<? super T>) in the type AllOf<T> is not applicable for the arguments (Matcher<Iterable<Song>>, Matcher<Collection<? extends Object>>)
依赖项是
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<version>4.10</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>hamcrest-core</artifactId>
<groupId>org.hamcrest</groupId>
</exclusion>
</exclusions>
</dependency>
我究竟做错了什么?
谢谢
斯特凡诺