2
assertThat(collection, allOf(hasItems(i1, i2, i3), hasSize(3)));
在Eclipse(運行爲 - > 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>
什麼時許ID錯了嗎?
感謝
斯特凡諾
謝謝@SpaceTrucker –