All Downloads are FREE. Search and download functionalities are using the official Maven repository.

grails.gorm.tests.QueryAfterPropertyChangeSpec.groovy Maven / Gradle / Ivy

There is a newer version: 2023.0.1
Show newest version
package grails.gorm.tests

/**
 * @author graemerocher
 */
class QueryAfterPropertyChangeSpec extends GormDatastoreSpec {

    void "Test that an entity is de-indexed after a change to an indexed property"() {
        given:
            def person = new Person(firstName:"Homer", lastName:"Simpson").save(flush:true)

        when:
            session.clear()
            person = Person.findByFirstName("Homer")

        then:
            person != null

        when:
            person.firstName = "Marge"
            person.save(flush:true)
            session.clear()
            person = Person.findByFirstName("Homer")

        then:
            Person.findByFirstName("Marge") != null
            person == null
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy