Java assert messages lost
My assert messages have mysteriously vanished from the console. The acceptance test still stops executing when an assert fails, but I see no message. I am using Eclipse 3.4.2.
- I have set (in Eclipse > Preferences... > Java > Compiler)(*):
- Compiler compliance level to 1.5
- Use default compliance settings is checked
- I have set (in Run > Run Configurations... > Java Application > [my application] > Arguments > VM arguments):
- I have code in a class static block to confirm that assert is enabled:
... and yes, the RuntimeException is thrown if I take the -enableassertions flag out of the VM arguments.
boolean assertsEnabled = false;
assert assertsEnabled = true; // Intentional side effect!!!
throw new RuntimeException("Asserts must be enabled for User Tests!!!");
- As I mentioned above, the execution is interrupted when an assertion fails - I simply don't see the message on the console.
- This was working. I put aside the project for a week, then came back to it, only to find this broken.
I don't know if I accidentally changed some setting, or if I've blanked on where I should be looking for the messages or what happened. Any suggestions appreciated.
(*) Yes, I'm using eclipse on Mac OS X. This should be the same Preferences panel as other users find under Window > Preferences...