Developers, Developers, Developers! Maksim Sorokin IT Blog

12Feb/100

Eclipse and JUnit 4 Static Imports

Importing static JUnit 4 annotations in Eclipse is somewhat boring. The thing is that by default Eclipse doesn't import static fields or methods.

The most optimal way is to add junit.framework.Assert to "favorite" static types. Then, assertion methods will be seen in editor.
How to:

  • Menu -> Window -> Preferences
  • Java -> Editor -> Content Assist -> Favorites
  • New Type: junit.framework.Assert

P.S.: idea taken from http://blog.xebia.com/2008/10/12/eclipse-tip-keep-static-imports-for-junit-4/

Comments (0) Trackbacks (1)

Leave a comment