We have some java code that we would ideally like to run in three ways:
- Throw an exception when an
assertfails - Print a stack trace, but otherwise continue when an
assertfails - Ignore an
assert
This is to be run in three different environments (development, testing, production, respectively). We can switch between the first and last by using the -ea JVM option, but is it possible to do the second?
Thanks.
EDIT: we already have assert statements everywhere. we prefer to change this option at run-time without changing our code.
assertin production in case we missed something. We don't want anassertto crash our testing environment, like a beta website. We want to know about the errors without having testing come to a halt.