折騰一上午, 終於解決了assertThat()無法運行的錯誤


問題描述:

1. assertThat()紅色報警

2. is()紅色報警

  

問題解決:

1. 導入  import static org.hamcrest.MatcherAssert.assertThat;  

 注意: 不要導入org.junit.Assert.assertThat, 因為這個包里的assertThat()已經Deprecated, 需要use org.hamcrest.MatcherAssert.assertThat() 

2. 導入   import static org.hamcrest.CoreMatchers.is;

 或者    import static org.hamcrest.core.Is.is;  

導入過程:

1.------------------------------------------------------------------------

2.---------------------------------------------------------------------------------

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM