Boolean constant for assert in if..else block I have the following condition statement in Groovy:

if ( condition_1 ) {
    //some actions
} else if ( condition_2 ) {
    //some another actions
} else {
    assert false, 'Assertion description'
}


Code Narc gives me a warning about using boolean false constant in the assertion. I'm not sure if it is real issue, so please share your thoughts about it.

I thought about using exceptions in this code instead of assert false but it looks too heavy (exception handling is too heavy I think) for my particular case.
Throwing an assert error is probably heavier than throwing an Exception (as Groovy will parse the assert inputs to give you a pretty output string)

And unless you are going to be running this hundreds of times per second, I wouldn't worry about it either way...

A way of using assert that gets round the warning (and provides a nice error message) might be to do:

assert condition_1 || condition_2, 'Expected at least condition_1 or condition_2 to be true'