Java 8 で AssertJ 3.5.2 の Condition クラスの使用法を調査しているときに、この問題に遭遇しました。一般的に型指定されたリストの Condition インスタンスを作成できますが、使用しようとすると Eclipse でエラー メッセージが表示されます。
Condition<List<MyBean>> listCond =
new Condition<>(list -> true, "test"); // OK
this.assertThat(myList).has(listCond); // DOES NOT COMPILE
私が得るエラーメッセージは次のとおりです。
The method has(Condition<? super List<? extends MyBean>>) in the type
AbstractListAssert<capture#8-of ?,List<? extends MyBean>,MyBean,ObjectAssert<MyBean>> is not
applicable for the arguments (Condition<List<MyBean>>)
リストの全体的なチェックを行うためのAssertJのこのアプローチまたは別のアプローチの解決策はありますか(アイテムごとではなく、シーケンスまたは集計に基づくチェック)?