Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Assertion doubt

 
ramya ray
Ranch Hand
Posts: 101
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doing java -ea Test will cause assertion enabled in default package or all the packages.

Please guide.

Thanks,
 
Jan Cumps
Bartender
Posts: 2577
11
C++ Linux Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic