Yi.
Yi.

Reputation: 525

assert whether a domain class table is empty in a grails service

Some static method did not get injected to grails services. But What if I wanna assert whether a domain class table is empty in a service?

Like in a controller, I can do:

assert DomainClass.count()==0 

What is the alternative in a grails service or a grails domain class?

Upvotes: 0

Views: 326

Answers (1)

dspies
dspies

Reputation: 1543

I'm not sure why it does not work as is, but it worked for me when I wrapped the assertion in braces

assert (DomainClass.count()==0)

Upvotes: 0

Related Questions