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 f07ddd11b72b1d26e61d78725ec65227165ce4b3 Author: Mattias Reichel <[email protected]> AuthorDate: Thu Aug 13 17:07:04 2026 +0200 test: reset fixtures and UserIntegrationSpec assertions --- .../grails-app/domain/grails/test/app/Address.groovy | 3 +++ .../grails-app/domain/grails/test/app/User.groovy | 3 --- .../grails/test/app/UserIntegrationSpec.groovy | 20 ++++++++++++++++---- .../main/groovy/grails/test/app/pogo/Profile.groovy | 6 ++++++ 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/grails-test-examples/graphql/grails-test-app/grails-app/domain/grails/test/app/Address.groovy b/grails-test-examples/graphql/grails-test-app/grails-app/domain/grails/test/app/Address.groovy index 98c769a502..b5c9ee73b0 100644 --- a/grails-test-examples/graphql/grails-test-app/grails-app/domain/grails/test/app/Address.groovy +++ b/grails-test-examples/graphql/grails-test-app/grails-app/domain/grails/test/app/Address.groovy @@ -26,5 +26,8 @@ class Address { Integer zip static constraints = { + city nullable: false + state nullable: false + zip nullable: false } } diff --git a/grails-test-examples/graphql/grails-test-app/grails-app/domain/grails/test/app/User.groovy b/grails-test-examples/graphql/grails-test-app/grails-app/domain/grails/test/app/User.groovy index 4baed680d7..375049925b 100644 --- a/grails-test-examples/graphql/grails-test-app/grails-app/domain/grails/test/app/User.groovy +++ b/grails-test-examples/graphql/grails-test-app/grails-app/domain/grails/test/app/User.groovy @@ -32,7 +32,6 @@ class User { Address address //embedded domain class static constraints = { - manager nullable: true profile nullable: false address nullable: false } @@ -45,8 +44,6 @@ class User { } static graphql = GraphQLMapping.build { - property('profile', nullable: false) - property('address', nullable: false) add('firstNumber', Integer) { //don't include this property in the list of properties to return from operations output(false) diff --git a/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/UserIntegrationSpec.groovy b/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/UserIntegrationSpec.groovy index 3977e0f8bf..87f29c71a4 100644 --- a/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/UserIntegrationSpec.groovy +++ b/grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/UserIntegrationSpec.groovy @@ -53,7 +53,10 @@ class UserIntegrationSpec extends Specification implements GraphQLSpec { Map obj = resp.body then: - obj.data.userCreate != null + obj.data == null + obj.errors.size() == 1 + obj.errors[0].message.startsWith('Validation error (WrongType@[userCreate])') + obj.errors[0].message.endsWith("is missing required fields '[profile]'") when: 'The profile is provided, but missing a required field' resp = graphQL.graphql(""" @@ -78,7 +81,10 @@ class UserIntegrationSpec extends Specification implements GraphQLSpec { obj = resp.body then: - obj.data.userCreate != null + obj.data == null + obj.errors.size() == 1 + obj.errors[0].message.startsWith('Validation error (WrongType@[userCreate])') + obj.errors[0].message.endsWith("is missing required fields '[lastName]'") } void "test creating a user without an address"() { @@ -101,7 +107,10 @@ class UserIntegrationSpec extends Specification implements GraphQLSpec { Map obj = resp.body then: - obj.data.userCreate != null + obj.data == null + obj.errors.size() == 1 + obj.errors[0].message.startsWith('Validation error (WrongType@[userCreate])') + obj.errors[0].message.endsWith("is missing required fields '[address]'") when: 'The address is provided, but missing a required field' resp = graphQL.graphql(""" @@ -126,7 +135,10 @@ class UserIntegrationSpec extends Specification implements GraphQLSpec { obj = resp.body then: - obj.data.userCreate != null + obj.data == null + obj.errors.size() == 1 + obj.errors[0].message.startsWith('Validation error (WrongType@[userCreate])') + obj.errors[0].message.endsWith("is missing required fields '[zip]'") } void "test creating the top level manager"() { diff --git a/grails-test-examples/graphql/grails-test-app/src/main/groovy/grails/test/app/pogo/Profile.groovy b/grails-test-examples/graphql/grails-test-app/src/main/groovy/grails/test/app/pogo/Profile.groovy index 670472acdb..5c11b8963f 100644 --- a/grails-test-examples/graphql/grails-test-app/src/main/groovy/grails/test/app/pogo/Profile.groovy +++ b/grails-test-examples/graphql/grails-test-app/src/main/groovy/grails/test/app/pogo/Profile.groovy @@ -28,4 +28,10 @@ class Profile { String firstName String lastName + static constraints = { + email nullable: false + firstName nullable: false + lastName nullable: false + } + }
