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 - Suggest Hints For Static Imports For JUnit, Hamcrest and Mockito Methods
Summary: Suggest Hints For Static Imports For JUnit, Hamcrest and Mockito Methods
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 7.2
Hardware: All All
: P1 normal with 1 vote (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-24 18:46 UTC by abien
Modified: 2013-05-20 15:20 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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'.