This is an automated email from the ASF dual-hosted git repository. matrei pushed a commit to branch fix/issue-16133 in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 592a3fb56c1241d223f23ae2b15ec0e7255a0d5c Author: Mattias Reichel <[email protected]> AuthorDate: Wed Aug 12 08:57:44 2026 +0200 test: reproduce issue 16133 See gh-16133 --- .../domain/functional/tests/Organization.groovy | 24 ++++++++++++ .../tests/OrganizationValidationSpec.groovy | 45 ++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/grails-test-examples/hibernate5/grails-hibernate/grails-app/domain/functional/tests/Organization.groovy b/grails-test-examples/hibernate5/grails-hibernate/grails-app/domain/functional/tests/Organization.groovy new file mode 100644 index 0000000000..a7776a4d52 --- /dev/null +++ b/grails-test-examples/hibernate5/grails-hibernate/grails-app/domain/functional/tests/Organization.groovy @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package functional.tests + +class Organization { + String name +} diff --git a/grails-test-examples/hibernate5/grails-hibernate/src/integration-test/groovy/functional/tests/OrganizationValidationSpec.groovy b/grails-test-examples/hibernate5/grails-hibernate/src/integration-test/groovy/functional/tests/OrganizationValidationSpec.groovy new file mode 100644 index 0000000000..59f5368441 --- /dev/null +++ b/grails-test-examples/hibernate5/grails-hibernate/src/integration-test/groovy/functional/tests/OrganizationValidationSpec.groovy @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package functional.tests + +import spock.lang.Specification + +import grails.gorm.transactions.Rollback +import grails.testing.mixin.integration.Integration + +@Integration +class OrganizationValidationSpec extends Specification { + + @Rollback + void "saving an organization without its name succeeds as nullable is true by default"() { + given: + def organization = new Organization() + + expect: + organization.validate() + !organization.hasErrors() + + when: + def savedOrganization = organization.save(flush: true) + + then: + savedOrganization == organization + Organization.count() == 1 + } +}
