I am following an example in the Grails In Action book. My integration test is failing because the searches in the example code are returning null references. I used a call to findAll() and now it appears my test data is not saving; all.size is coming back as zero.
void testBasicDynamicFinders() {
new User(userId: 'glen', password: 'secret', profile: new Profile(email: '[email protected]')).save()
new User(userId: 'peter', password: 'sesame', profile: new Profile(homepage: 'http://www.peter.com/')).save()
def all = User.findAll()
assertEquals 2, all.size()
}
I have tried using save(flush: true) to no avail.
I have also enclosed one of the save statements in a try...catch structure, but no exception appears to be raised.
Grails is really kicking my butt. Please help me?
If you use
save( failOnError:true )
Then it should show you any validation errors that are preventing the domain objects from being saved :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With