折腾一上午, 终于解决了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