Bug 170707 - Create empty JUnit test throws exception
Create empty JUnit test throws exception
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: JUnit
6.x
All All
: P2 (vote)
: 6.x
Assigned To: Victor Vasilyev
junit-issues@java
http://statistics.netbeans.org/except...
EXCEPTIONS_REPORT
: ERGONOMICS
: 170810 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-08-20 14:56 UTC by pribyl
Modified: 2009-09-14 14:12 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
The IDE log after three sequential attempts to create JUnit test. (46.99 KB, text/plain)
2009-08-22 02:19 UTC, Victor Vasilyev
Details
stacktrace (7.82 KB, text/plain)
2009-09-14 14:12 UTC, Maksim Khramov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pribyl 2009-08-20 14:56:27 UTC
Build: NetBeans IDE Dev (Build 200908171401)
VM: Java HotSpot(TM) Client VM, 14.1-b02, Java(TM) SE Runtime Environment, 1.6.0_15-b03
OS: Windows XP, 5.1, x86

Create new Java Application (or Web Application, I was able to reproduce it in both cases).
Select File - New File - JUnit - JUnit test
Leave default setting and press "Finish"
-> Exception is thrown, the test is not created, all buttons of the New File dialog are disabled (except Help button)

The only way how to create JUnit test file is to create new Java class and invoke Tools - Create JUnit test

Stacktrace: 
java.lang.AssertionError
        at org.netbeans.modules.junit.DefaultPlugin.createTestActionCalled(DefaultPlugin.java:1020)
        at org.netbeans.modules.junit.plugin.JUnitPlugin$1.createTestActionCalled(JUnitPlugin.java:74)
        at org.netbeans.modules.junit.wizards.EmptyTestCaseWizardIterator.instantiate(EmptyTestCaseWizardIterator.java:294)
        at org.netbeans.modules.ide.ergonomics.newproject.DescriptionStep$2.instantiate(DescriptionStep.java:301)
        at
org.netbeans.modules.ide.ergonomics.newproject.FeatureOnDemanWizardIterator.instantiate(FeatureOnDemanWizardIterator.java:187)
        at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1016)
        at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:588)
        at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:409)
        at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:253)
        at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(TemplateWizardIteratorWrapper.java:165)
        at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1524)
Comment 1 pribyl 2009-08-20 15:06:03 UTC
This problem is reproducible only with 'Features on Demand' turned on
Comment 2 Victor Vasilyev 2009-08-22 02:15:09 UTC
Build Configuration Note: To catch the bug additionally to the basic cluster the ide.ergonomics module should be also built.

I confirm that the bug is reproducible on
Product Version: NetBeans IDE Dev (Build 090819)
Java: 1.6.0_13; Java HotSpot(TM) Client VM 11.3-b02
System: Windows XP version 5.1 running on x86; Cp1251; ru_RU (nb)
Userdir: C:\Documents and Settings\vvg\.netbeans\dev
Comment 3 Victor Vasilyev 2009-08-22 02:19:50 UTC
Created attachment 86534 [details]
The IDE log after three sequential attempts to create JUnit test.
Comment 4 Victor Vasilyev 2009-08-22 02:48:08 UTC
Note, before each of three assertion errors there is a log record like this:

SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.openide.WizardDescriptor$Listener$2$1

And, each assertion error caused by the org.openide.util.RequestProcessor$SlowItem with a message "task failed due to ..."

I think, implementation of the junit module is correct and the bug is outside of that module.
See the assertion point in the code of the junit module:
http://hg.netbeans.org/main/file/1c5ab8f7d046/junit/src/org/netbeans/modules/junit/DefaultPlugin.java#l1020

Probably, the issue 20467 has a relation to this bug.

Most likely a root cause of this issue is incorrect manipulation of the threads from viewpoint of AWT in a case when a
feature is involved in activating. 
Comment 5 pribyl 2009-08-24 14:52:08 UTC
*** Issue 170810 has been marked as a duplicate of this issue. ***
Comment 6 Victor Vasilyev 2009-08-30 20:06:56 UTC
Jesse Glick has suggested to delete the assertion, because there aren't any reason to run code of wizards in the event
queue dispatch thread. Hence, I've removed (actually commented out) all such assertions in the JUnit module. 
After this the bug is not reproducible and a JUnit test can be created without any problems. 

Fixed in the main trunk
http://hg.netbeans.org/main/rev/7682a1c75ec4
Comment 7 Maksim Khramov 2009-09-14 14:12:06 UTC
Build: NetBeans IDE Dev (Build nbms-and-javadoc-3923-on-090911)
VM: Java HotSpot(TM) Client VM, 14.1-b02, Java(TM) Platform, Standard Edition for Business, 1.6.0_15-b03
OS: Windows XP, 5.1, x86

User Comments: 


Stacktrace: 
java.lang.AssertionError
        at org.netbeans.modules.junit.DefaultPlugin.createTestActionCalled(DefaultPlugin.java:1020)
        at org.netbeans.modules.junit.plugin.JUnitPlugin$1.createTestActionCalled(JUnitPlugin.java:74)
        at org.netbeans.modules.junit.wizards.EmptyTestCaseWizardIterator.instantiate(EmptyTestCaseWizardIterator.java:294)
        at org.netbeans.modules.ide.ergonomics.newproject.DescriptionStep$2.instantiate(DescriptionStep.java:301)
        at org.netbeans.modules.ide.ergonomics.newproject.FeatureOnDemanWizardIterator.instantiate(FeatureOnDemanWizardIterator.java:187)
        at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1016)
Comment 8 Maksim Khramov 2009-09-14 14:12:26 UTC
Created attachment 87606 [details]
stacktrace


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo