Using static methods with content assist

Frameworks like JUnit and Hamcrest are offering APIs that are to be used with Java static imports so you can write “DSL-like” code:

assertThat(Math.sqrt(-1), is(notANumber()));

You can add classes offering such static methods in Preferences > Java > Editor > Content Assist > Favorites:

Using static methods with content assist

These methods will be proposed in content assist automatically:

Using static methods with content assist

Ralf Ebert

Ralf Ebert is an independent software developer, technical writer and trainer. He makes apps for Mac OS X and iOS and builds software solutions for companies using Eclipse RCP and Ruby on Rails. He offers training courses for software developers and writes books and articles about software development.