Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Assertion doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Assertion doubt" Watch "Assertion doubt" New topic
Author

Assertion doubt

ramya ray
Ranch Hand

Joined: Aug 11, 2006
Posts: 101
Doing java -ea Test will cause assertion enabled in default package or all the packages.

Please guide.

Thanks,
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

You could test this:

Create a small class (YourClass), in a package (yourpackage), that has an "assert false;" in it's main() method.
Compile the class.

Then run java -cp . -ea yourpackage/YourClass

If the assert is triggered, this indicates that the -ea switch does not mean "switch assert on for default package".

(the default package is the location for classes that are not in a package, and your test class is in the package yourpackage)

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Assertion doubt
 
Similar Threads
Assertion
A assertions qustion help about Man's mock!
asseertion
Assertion is not in beta ...
Assertion