Tuesday, February 28, 2012

Static imports in Eclipse

When working with testing frameworks such as Junit and Mockito, static imports are quite common. However, Eclipse does not handle those so well when pressing Ctrl+Enter, if they are not already imported. To hint Eclipse of which classes you want to look in for static imports, this handy trick could be useful: under
Java->Editor->Content Assist->Favorites
Choose new Type... and add org.mockito.Mockito and the other classes from which you need static methods.

Thanks to http://piotrjagielski.com/blog/working-with-static-imports-in-eclipse/

No comments:

Post a Comment