Community
Participate
Working Groups
When a new JUnit 4 test class is created, it would be great if it added at the top: import static org.junit.Assert.*; This is usually necessary to do anything productive, and Eclipse currently does not provide a quick-fix to import statics.
The Assert is already added by the wizard: if (isJUnit4()) { imports.addStaticImport("org.junit.Assert", "*", false); but gets removed by NewTestCaseWizardPageOne.removeUnusedImports() which is private. According to Martin we could use the import template but he's not sure whether to fix this bug at all because it would generate a CU with a warning or even an error if unused imports is set to 'error'. A possible solution would be to add a checkbox to the wizard which lets the user choose the import. Setting target milestone to RC4 so that Martin can decide next week.
not for 3.2. Note that we have a quick fix that can add the static import. Just no code assist.
See bug 152123 for suggestion of general code assist support for references with static imports
The JUnit wizard could now ask the user whether to add Assert to the favorties and update the PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS preference accordingly.
I was hoping to add this to project settings rather than workspace settings. What are the plans here?
No projects settings for now.
If I remove import static org.junit.Assert.assertTrue; from the imports Cntrl+Shirt + O (Organize Imports) will not create this import. Is this problem related to this, or shall I open a separate bug report?
>Is this problem related to this, or shall I open a separate bug report? Not related, see bug 94078.
@Dani: I think this works since I while. I suggest to close this bug.
Works for me using 3.8 RC1.