This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 211661

Summary: Suggest Hints For Static Imports For JUnit, Hamcrest and Mockito Methods
Product: editor Reporter: abien <abien>
Component: Completion & TemplatesAssignee: Dusan Balek <dbalek>
Status: RESOLVED FIXED    
Severity: normal CC: pjiricka
Priority: P1    
Version: 7.2   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description abien 2012-04-24 18:46:39 UTC
Currently, code completion for static imports does not work. It means: you cannot just write: 

assertThat and push ctrl+space to create the import-statement: import static org.junit.Assert.*;

Also commonly used imports for: import static org.hamcrest.CoreMatchers.*;
and import static org.mockito.Mockito.*; should be generated after clicking ctrl+space.
Comment 1 dharkness 2012-07-02 17:46:04 UTC
I believe that Eclipse has a nice feature to add "favorite" packages to automatically search for static imports. This would be a great feature for NetBeans.
Comment 2 Dusan Balek 2013-05-20 15:20:33 UTC
Code completion for static imports is one of the new features implemented for NB 7.4. Try to write 'assert' and press 'Ctrl+Space' twice (or alternatively 'Ctrl+Alt+Space' once) - 'all' completion popup should appear presenting all available assert* methods. Please note that static members are prefixed by their corresponding class names when completed by default. If you prefer static imports to be added, please check the corresponding box in 'Tools -> Options -> Editor -> Formatting -> Java -> Imports'.