简体   繁体   中英

Hamcrest's closeTo is not available to use

closeTo method of hamcrest is not available for me to use in Eclipse. Other methods like is , iscloseto are available.

I am beginning to learn Spring and following a video tutorial. In it the instructor is using closeTo inside is to test a method. It does not work for me. The gradle dependency is there. 在此处输入图片说明 在此处输入图片说明

If you type the full qualified name Matchers.closeTo which should work.

If you want to just type closeTo and get Eclipse to suggest you the available methods , you have to configure static import in Eclipse first. Add org.hamcrest.Matchers.* to the Favorites (See this ):

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM