Is there a way to stop System.assert calls from executing throughout an org by a setting or programmatically?
I did not see anything in the Apex System class docs and the docs explicitly state that an assertion failure generates an exception that cannot be caught in a try/catch.
Right now, if I have code such as the following in my sandbox
public class MyController() {
public MyController() {
System.assert(false, 'Fail');
}
}
it will result in the following being displayed when the VF page is rendered.
Assertion Failed: Fail
An unexpected error has occurred. Your development organization has been notified.
Java assert has had that capability. See Programming With Assertions - Enabling and Disabling Assertions, which is why I'm asking.
I know that it is debatable whether it is good practice or not to turn off assertions in production code, but I'm just interested in knowing how this can be done.
