私は大学からサンプルコードを入手し、プロジェクトをインポートして、テストを実行しようとしました: The method assertThat(Integer, Matcher) is ambiguous for the type MyClass
すべての assertThat は同じエラーメッセージで赤くマークされているので、問題を説明する最も単純なテストを作成しようとしました:
import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
@Test
public void whenAssertThatThenItIsAmbiguous() {
List<String> list = Arrays.asList("A", "B", "C");
assertThat(list.size(), is(3));
}
assertThat をスクロールすると、次のメッセージが表示されます。
The method assertThat(Integer, Matcher<Integer>) is ambiguous for the type MyClass
グーグルとスタックオーバーフローを検索しましたが、同じ問題を抱えている人は見つかりませんでした...助けてください。
EDIT1:
解決:
import static org.junit.Assert.*; // この行を削除