eclipse tips: useful content assist favorites feature

来源:互联网 发布:云计算工作好吗 编辑:程序博客网 时间:2024/05/22 01:32

when using library like Mockito where there is a lot of static method call, it is very annoying always to write Mockito.when(), Matcher.anyList(), or to define the static import.  Eclipse provide a convenient way to handle such problem. 

Open Menu Windows -> Preferences

Goto Java -> Editor -> Content -> Favorites and define your Favorities like below:



Now open a Java Class which can access the Mockito Library, goto a method. Type for example "mo" and then type ctrl+ space to start the content assist, you will see methods mock(...) from Mockito at the top of the suggestion list.