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 124830

Summary: Enable Java assertions when running JUnit tests
Product: java Reporter: fommil <fommil>
Component: JUnitAssignee: Victor Vasilyev <vvg>
Status: RESOLVED FIXED    
Severity: blocker Keywords: UMBRELLA
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
URL: http://www.nabble.com/JUnits-and-default-settings-to14635875.html
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 175517    
Bug Blocks: 139035    

Description fommil 2008-01-07 19:29:39 UTC
The current behaviour is that assertions are disabled by default when running tests. The only fix that I am aware of is to add the vmargs "-ea" to each project. 
However, this has the disadvantage that it is not a global setting and forces main classes to also run with assertions enabled.

I believe that assertions should be enabled by default for the junit tasks. (e.g. by adding <jvmarg line="-ea"/> to the <junit> when JDK >= 1.4).
Comment 1 fommil 2008-03-20 21:58:11 UTC
has this been assigned to anybody?
Comment 2 fommil 2008-07-03 23:52:13 UTC
So everybody is ok with assertions being disabled by default for runs of Unit tests?

The only workaround that I know of is to add '-ea' to the run parameters, which obviously mean that the live run has assertions... not good.
Comment 3 Victor Vasilyev 2010-10-11 03:54:55 UTC
See details about fix in the Bug 175517