grails.gorm.tests.QueryByAssociationSpec.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grails-datastore-gorm-tck Show documentation
Show all versions of grails-datastore-gorm-tck Show documentation
GORM - Grails Data Access Framework
package grails.gorm.tests
/**
* Abstract base test for query associations. Subclasses should do the necessary setup to configure GORM
*/
class QueryByAssociationSpec extends GormDatastoreSpec {
void "Test query entity by single-ended association"() {
given:
def age = 40
["Bob", "Fred", "Barney", "Frank"].each { new TestEntity(name:it, age: age++, child:new ChildEntity(name:"$it Child")).save() }
when:
def child = ChildEntity.findByName("Barney Child")
then:
child != null
child.id != null
when:
def t = TestEntity.findByChild(child)
then:
t != null
"Barney" == t.name
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy