Java assert messages lost
Hi folks,
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):
-enableassertions - I have code in a class static block to confirm that assert is enabled:
Code:
static {
boolean assertsEnabled = false;
assert assertsEnabled = true; // Intentional side effect!!!
if (!assertsEnabled)
throw new RuntimeException("Asserts must be enabled for User Tests!!!");
}
... and yes, the RuntimeException is thrown if I take the -enableassertions flag out of the VM arguments. - 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.
Thank you,
David
(*) Yes, I'm using eclipse on Mac OS X. This should be the same Preferences panel as other users find under Window > Preferences...