Eclipse tips and tricks — Static imports
How many times have I typed import static org.junit.Assert.* while writing tests, only to write assertThat in a test method and curse because I still have to import other static methods? There’s a much easier way. Eclipse lets you add methods from selected types to Content Assist, which then suggests them even when the type hasn’t been imported in the class. When you use a method, Eclipse adds the import to the class automatically.

Go to Window >> Preferences >> Java >> Editor >> Content Assist >> Favorites. Use New Type to add an entire type and all its static methods, or New Member to add just the methods you want.

Related articles
Related CZ Podcast episodes
- #3 · Java 6 SE, Vývoj webových aplikací
Dagi and Filemon discuss Java 6 and web application frameworks. · Czech audio
- #1 · Vývojová prostředí v Javě
The first CZ Podcast episode looks at Java development environments. · Czech audio