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

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

There is a newer version: 9.0.0-M2
Show newest version
package grails.gorm.tests

class NullValueEqualSpec extends GormDatastoreSpec {

  void "test null value in equal and not equal"() {
    when:
    new TestEntity(name:"Fred", age: null).save(failOnError: true)
    new TestEntity(name:"Bob", age: 11).save(failOnError: true)
    new TestEntity(name:"Jack", age: null).save(flush:true, failOnError: true)

    then:
    TestEntity.countByAge(11) == 1
    TestEntity.findAllByAge(null).size() == 2
    TestEntity.countByAge(null) == 2

    TestEntity.countByAgeNotEqual(11) == 2
    TestEntity.countByAgeNotEqual(null) == 1
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy