This may be a silly question, but I am curious how this operates -
If I have an Elvis operator with an and / or logic in the then clause, how should I write the operation? That sounds confusing, I know, so let me give an example...
testVal = test1 ?: test2 && test3
testVal = (test1 ?: test2) && test 3
If test1 fails, do test2 - let's call this result test12.
testVal = test12 && test3
test1 ?: (test2 && test3)
If test1 fails, do test2 and test 3 - let's call this result test23.
testVal = test1 && test23
Please have a look on operator precedence section in Groovy documentation.
&& has lower precedence than
?: so the option
test1 ?: (test2 && test3) will be correct.