In Java it\'s known that using the assert
keyword is usually a bad idea, as its behavior is dependant on the runtime enviornment (it doesn\'t do anything by def
Groovy assert is always executed in production code, and I recommended to use in production. I see the following as being roughly equivalent, but the Groovy version is more compact
assert file.exists(), "$file does not exist"
if (!file.exists()) {
throw new SomeRuntimeException(file + " does not exist");
}