logo

JUnit & Eclipse tip: Content Assist

Writing a JUnit test in Eclipse is out-of-the-box a pain, how to change that?

Writing a JUnit test in Eclipse is out-of-the-box a pain, because when you press CTRL + SHIFT + O to organize imports, Eclipse will remove:

import static org.junit.Assert.*;

Now when you want to use JUnit assert method, you either need to add correct import, or use it without import. Unless you know about configuring favorites in the preferences. Goto Window -> Preferences -> Java -> Editor -> Content Assist -> Favorites and add New Type:

org.junit.Assert

Now when you type assert and press CTRL + SPACE, Eclipse content assist will also show proposals for static methods from org.junit.Assert.


comments powered by Disqus

rss

Free online Java web application examples

Want to develop whole web applications which use database, security and more? See my github account, where are lot's of example projects:
github

Search