This might seem simple but it's my first time dealing with groovy and database interactions
I have to get something from the database and check if it's NOT NULL, I'll throw an Exception
PaymentDetails details = PaymentDetails.findById(id)
What is the groovy way to check if the details
is NOT NULL?
Is condition seems wrong :(
if (!details) {
println("ERROR!!!!")
throw new InvalidException()
}
Thanks in advance!
if (details) {
println("ERROR!!!!")
throw new InvalidException()
}
Refer to docs on The Groovy Truth to understand how Groovy decides on boolean expressions.