I had been happily putting assert's in my Java tests and assuming they were working. Until there was one that really should have been failing. Hmmm... I added "assert false" and it still succeeded. What's going on?!
Then I remembered reading somewhere that assert checking is disabled by default. Doh!
You enable this via a command line argument to Java. In Eclipse you can do this in the Run item settings or you can make it the default in Window > Preferences > Java > Installed JREs > Edit > Default VM Arguments: -ea
Of course, once I enabled assert checking I found that a number of my tests were failing (had been all along). Thankfully they were easy to fix!
For now, I've enabled assert checking. But perhaps I shouldn't be using assert in my tests.
For the majority of my assert's I prefer if they are always checked. The exception would be particularly slow assert's you might want to disable in production.
In my C++ Suneido code I ended up using my own "verify" instead of assert that is never disabled. Because it is never disabled I can use it with expressions that are actual part of the functionality. This avoids temporary variables whose sole purpose is to be checked by an assert. e.g.
bool result = myfunc();
I may end up doing the same thing in Java - I'll see how it goes.