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

 

 

posted @ 2020-09-14 22:45  mayingdts  阅读(2262)  评论(0编辑  收藏  举报