2016-05-25 8 views
1

以下のコードは2つのリストを比較しています。 私のステップでは、if文を使用してdestinationListが空であるかどうかを確認します。そうであれば、テストが正しく、キュウリのステップを進める必要があります。キュウリ試験を失敗させることは可能ですか?

しかし、else文に達した場合、キュウリ試験に失敗する原因がありますか? `

if (destinationList.isEmpty()) { 
    System.out.println("This report is correct"); 

} else { 
    System.out.println("This report is incorrect."); 
    System.out.println("This list conatains the expected values of the report and their locations:"); 
    System.out.println("expected = "+sourceList); 
    System.out.println("This list contains the actual value from this report and their locations:"); 
    System.out.println("actual = "+destinationList); 
} 

答えて

-1

からの静的メソッドである

fail("Reason of fail") 

を使用している場合、私は答えを見つけました。 私は最初にassert failを試していましたが、これは動作しませんでした。

正しい構文がAssert.fail();であることが判明しました。これは私のelse文の最後に含まれています。

関連する問題