タイトルのとおり、ループでテスト ケースを実行しようとしています。失敗したアサーションの数を計算できるようにするために、AssertJ がメソッド呼び出しから返された値をアサートしようとしている場合、1 回の反復をソフトに失敗させて続行することを期待しています。そうしないと、ソフト アサーションの目的に反します。これを説明するスニペットを次に示します。
public static void main(String[] args) {
SoftAssertions softAssertions = new SoftAssertions();
softAssertions.assertThat(throwException(10)).isTrue();
softAssertions.assertThat(throwException(10)).isTrue();
softAssertions.assertThat(throwException(1)).isTrue();
softAssertions.assertAll();
}
private static boolean throwException(int stuff){
if(stuff == 1){
throw new RuntimeException();
}
return true;
}
出力:
Exception in thread "main" java.lang.RuntimeException
at eLCMUpdate.throwException(MyClass.java:101)
at eLCMUpdate.main(MyClass.java:95)
ここで何かが欠けています。私は何か間違ったことをしていますか?