@@ -52,17 +52,18 @@ class CommandObjectConstraintGettersSpec extends Specification {
5252 }
5353
5454
55- void ' ensure only public non-static properties with getter and setter are constrained properties' () {
55+ void ' ensure only public non-static properties with getter are constrained properties' () {
5656 MethodPropertiesCommand command = new MethodPropertiesCommand ()
5757
5858 when : ' empty command with method properties is validated'
5959 command. validate()
6060
6161 // anotherPublicProperty did not error because it is boolean which defaults to false
62- then : ' only public with getter and setter should fail'
62+ then : ' only public with getter should fail'
6363 command. hasErrors()
6464 command. errors[' booleanPublicProperty' ]?. code == ' nullable'
65- command. errors. getErrorCount() == 1
65+ command. errors[' getterOnly' ]?. code == ' nullable'
66+ command. errors. getErrorCount() == 2
6667 }
6768
6869
@@ -71,9 +72,10 @@ class CommandObjectConstraintGettersSpec extends Specification {
7172 Map constrainedProperties = MethodPropertiesCommand . getConstraintsMap()
7273
7374 then : ' only public property with getter and setter should fail'
74- constrainedProperties. size() == 2
75+ constrainedProperties. size() == 3
7576 constrainedProperties. containsKey(' anotherPublicProperty' )
7677 constrainedProperties. containsKey(' booleanPublicProperty' )
78+ constrainedProperties. containsKey(' getterOnly' )
7779 }
7880
7981 // COMMAND OBJECT WITH SUPER CLASS
@@ -104,7 +106,7 @@ class CommandObjectConstraintGettersSpec extends Specification {
104106 }
105107
106108
107- void ' ensure only public non-static inherited properties with getter and setter are constrained properties' () {
109+ void ' ensure only public non-static inherited properties with getter are constrained properties' () {
108110 InheritedMethodPropertiesCommand command = new InheritedMethodPropertiesCommand ()
109111 when : ' empty command with method properties is validated'
110112 command. validate()
@@ -113,18 +115,20 @@ class CommandObjectConstraintGettersSpec extends Specification {
113115 then : ' only public with getter and setter should fail'
114116 command. hasErrors()
115117 command. errors[' booleanPublicProperty' ]?. code == ' nullable'
116- command. errors. getErrorCount() == 1
118+ command. errors[' getterOnly' ]?. code == ' nullable'
119+ command. errors. getErrorCount() == 2
117120 }
118121
119122
120- void ' ensure constrained inherited method properties are only public ones with both getter and setter ' () {
123+ void ' ensure constrained inherited method properties are only public ones with getter' () {
121124 when : ' constrained properties map is get from child class'
122125 Map constrainedProperties = InheritedMethodPropertiesCommand . getConstraintsMap()
123126
124127 then : ' only public with getter and setter should be there'
125- constrainedProperties. size() == 2
128+ constrainedProperties. size() == 3
126129 constrainedProperties. containsKey(' anotherPublicProperty' )
127130 constrainedProperties. containsKey(' booleanPublicProperty' )
131+ constrainedProperties. containsKey(' getterOnly' )
128132 }
129133
130134 // COMMAND OBJECT WITH TRAIT
@@ -155,7 +159,7 @@ class CommandObjectConstraintGettersSpec extends Specification {
155159 }
156160
157161
158- void ' ensure only public non-static properties from trait with getter and setter are constrained properties' () {
162+ void ' ensure only public non-static properties from trait with getter are constrained properties' () {
159163 TraitMethodPropertiesCommand command = new TraitMethodPropertiesCommand ()
160164 when : ' empty command with simple properties is validated'
161165 command. validate()
@@ -164,23 +168,25 @@ class CommandObjectConstraintGettersSpec extends Specification {
164168 then : ' all should fail on nullable constraint'
165169 command. hasErrors()
166170 command. errors[' booleanPublicProperty' ]?. code == ' nullable'
167- command. errors. getErrorCount() == 1
171+ command. errors[' getterOnly' ]?. code == ' nullable'
172+ command. errors. getErrorCount() == 2
168173 }
169174
170175
171- void ' ensure constrained method properties from trait are only public ones with both getter and setter ' () {
176+ void ' ensure constrained method properties from trait are only public ones with getter' () {
172177 when : ' constrained properties map is get'
173178 Map constrainedProperties = TraitMethodPropertiesCommand . getConstraintsMap()
174179
175180 then : ' only 4 defined public properties are there'
176- constrainedProperties. size() == 2
181+ constrainedProperties. size() == 3
177182 constrainedProperties. containsKey(' anotherPublicProperty' )
178183 constrainedProperties. containsKey(' booleanPublicProperty' )
184+ constrainedProperties. containsKey(' getterOnly' )
179185 }
180186
181187 // BOOL METHODS COMMAND OBJECT
182188
183- void ' ensure only public non-static bool properties with getter and setter are constrained properties' () {
189+ void ' ensure only public non-static bool properties with getter are constrained properties' () {
184190 BoolMethodPropertiesCommand command = new BoolMethodPropertiesCommand ()
185191 when : ' empty command with method properties is validated'
186192 command. validate()
@@ -189,23 +195,25 @@ class CommandObjectConstraintGettersSpec extends Specification {
189195 then : ' only public with getter and setter should fail'
190196 command. hasErrors()
191197 command. errors[' booleanPublicProperty' ]?. code == ' nullable'
192- command. errors. getErrorCount() == 1
198+ command. errors[' getterOnly' ]?. code == ' nullable'
199+ command. errors. getErrorCount() == 2
193200 }
194201
195202
196- void ' ensure constrained bool method properties are only public ones with both getter and setter ' () {
203+ void ' ensure constrained bool method properties are only public ones with getter' () {
197204 when : ' constrained properties map is get'
198205 Map constrainedProperties = BoolMethodPropertiesCommand . getConstraintsMap()
199206
200207 then : ' only public property with getter and setter should fail'
201- constrainedProperties. size() == 2
208+ constrainedProperties. size() == 3
202209 constrainedProperties. containsKey(' anotherPublicProperty' )
203210 constrainedProperties. containsKey(' booleanPublicProperty' )
211+ constrainedProperties. containsKey(' getterOnly' )
204212 }
205213
206214 // BOOL COMMAND OBJECT WITH SUPER CLASS
207215
208- void ' ensure only public non-static inherited bool properties with getter and setter are constrained properties' () {
216+ void ' ensure only public non-static inherited bool properties with getter are constrained properties' () {
209217 InheritedBoolMethodPropertiesCommand command = new InheritedBoolMethodPropertiesCommand ()
210218 when : ' empty command with method properties is validated'
211219 command. validate()
@@ -214,23 +222,25 @@ class CommandObjectConstraintGettersSpec extends Specification {
214222 then : ' only public with getter and setter should fail'
215223 command. hasErrors()
216224 command. errors[' booleanPublicProperty' ]?. code == ' nullable'
217- command. errors. getErrorCount() == 1
225+ command. errors[' getterOnly' ]?. code == ' nullable'
226+ command. errors. getErrorCount() == 2
218227 }
219228
220- void ' ensure constrained inherited bool method properties are only public ones with both getter and setter ' () {
229+ void ' ensure constrained inherited bool method properties are only public ones with getter' () {
221230 when : ' constrained properties map is get from child class'
222231 Map constrainedProperties = InheritedBoolMethodPropertiesCommand . getConstraintsMap()
223232
224233 then : ' only public with getter and setter should be there'
225- constrainedProperties. size() == 2
234+ constrainedProperties. size() == 3
226235 constrainedProperties. containsKey(' anotherPublicProperty' )
227236 constrainedProperties. containsKey(' booleanPublicProperty' )
237+ constrainedProperties. containsKey(' getterOnly' )
228238 }
229239
230240 // BOOL COMMAND OBJECT WITH TRAIT
231241
232242
233- void ' ensure only public non-static bool properties from trait with getter and setter are constrained properties' () {
243+ void ' ensure only public non-static bool properties from trait with getter are constrained properties' () {
234244 TraitBoolMethodPropertiesCommand command = new TraitBoolMethodPropertiesCommand ()
235245 when : ' empty command with simple properties is validated'
236246 command. validate()
@@ -239,17 +249,19 @@ class CommandObjectConstraintGettersSpec extends Specification {
239249 then : ' all should fail on nullable constraint'
240250 command. hasErrors()
241251 command. errors[' booleanPublicProperty' ]?. code == ' nullable'
242- command. errors. getErrorCount() == 1
252+ command. errors[' getterOnly' ]?. code == ' nullable'
253+ command. errors. getErrorCount() == 2
243254 }
244255
245- void ' ensure constrained bool method properties from trait are only public ones with both getter and setter ' () {
256+ void ' ensure constrained bool method properties from trait are only public ones with getter' () {
246257 when : ' constrained properties map is get'
247258 Map constrainedProperties = TraitBoolMethodPropertiesCommand . getConstraintsMap()
248259
249260 then : ' only 4 defined public properties are there'
250- constrainedProperties. size() == 2
261+ constrainedProperties. size() == 3
251262 constrainedProperties. containsKey(' anotherPublicProperty' )
252263 constrainedProperties. containsKey(' booleanPublicProperty' )
264+ constrainedProperties. containsKey(' getterOnly' )
253265 }
254266}
255267
0 commit comments