Skip to content

Commit 898ed41

Browse files
Collection and Map properties default to nullable:true
See https://github.com/grails/grails-core/blob/758dbcc40112b19d4f5f8fbc7446e cdd4ebdc020/grails-validation/src/main/groovy/org/grails/validation/Defa ultConstraintEvaluator.java#L359
1 parent 758dbcc commit 898ed41

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

grails-test-suite-uber/src/test/groovy/grails/validation/CommandObjectConstraintGettersSpec.groovy

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class CommandObjectConstraintGettersSpec extends Specification {
2626

2727
// STANDARD COMMAND OBJECT
2828

29-
@Ignore
3029
void 'ensure all public properties are by default constraint properties'() {
3130
SimplePropertiesCommand command = new SimplePropertiesCommand()
3231

@@ -35,11 +34,9 @@ class CommandObjectConstraintGettersSpec extends Specification {
3534

3635
then: 'only public should fail on nullable constraint'
3736
command.hasErrors()
38-
command.errors['list']?.code == 'nullable'
39-
command.errors['map']?.code == 'nullable'
4037
command.errors['string']?.code == 'nullable'
4138
command.errors['book']?.code == 'nullable'
42-
command.errors.getErrorCount() == 4
39+
command.errors.getErrorCount() == 2
4340
}
4441

4542
void 'ensure constrained properties are only public ones'() {
@@ -78,20 +75,17 @@ class CommandObjectConstraintGettersSpec extends Specification {
7875

7976
// COMMAND OBJECT WITH SUPER CLASS
8077

81-
@Ignore
8278
void 'ensure all inherited public properties are by default constraint properties'() {
8379
InheritedPropertiesCommand command = new InheritedPropertiesCommand()
8480

8581
when: 'empty command with simple properties from parent class inheriteds validated'
8682
command.validate()
8783

88-
then: 'all public should fail on nullable constraint'
84+
then: 'all non collection public properties should fail on nullable constraint'
8985
command.hasErrors()
90-
command.errors['list']?.code == 'nullable'
91-
command.errors['map']?.code == 'nullable'
9286
command.errors['string']?.code == 'nullable'
9387
command.errors['book']?.code == 'nullable'
94-
command.errors.getErrorCount() == 4
88+
command.errors.getErrorCount() == 2
9589
}
9690

9791
void 'ensure inherited constrained properties are only public ones'() {
@@ -130,7 +124,6 @@ class CommandObjectConstraintGettersSpec extends Specification {
130124

131125
// COMMAND OBJECT WITH TRAIT
132126

133-
@Ignore
134127
void 'ensure all trait public properties are by default constraint properties'() {
135128
TraitPropertiesCommand command = new TraitPropertiesCommand()
136129

@@ -139,11 +132,9 @@ class CommandObjectConstraintGettersSpec extends Specification {
139132

140133
then: 'only public should fail on nullable constraint'
141134
command.hasErrors()
142-
command.errors['list']?.code == 'nullable'
143-
command.errors['map']?.code == 'nullable'
144135
command.errors['string']?.code == 'nullable'
145136
command.errors['book']?.code == 'nullable'
146-
command.errors.getErrorCount() == 4
137+
command.errors.getErrorCount() == 2
147138
}
148139

149140
void 'ensure constrained properties are only traits public ones'() {

0 commit comments

Comments
 (0)