Assertions in NetBeans
To enable assertions in NetBeans, create a new configuration for executing your Java application. In the new configuration, assertions are enabled.
Open the project properties
Click right on your project and select "Properties" then go to the "Run" category:
Click on "New" to create a new configuration. Enter the name of the configuration:
Click "OK" and enter the additional Java VM option to enable assertions:
Now you just have to switch between configurations to enable/disable the assertions in your project.