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 - Enable Java assertions when running JUnit tests
Summary: Enable Java assertions when running JUnit tests
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: JUnit (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Victor Vasilyev
URL: http://www.nabble.com/JUnits-and-defa...
Keywords: UMBRELLA
Depends on: 175517
Blocks: 139035
  Show dependency tree
 
Reported: 2008-01-07 19:29 UTC by fommil
Modified: 2010-10-11 03:54 UTC (History)
0 users

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 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