package com.example.dev;
public class AClass {
private Integer a =10;
...//other code
}
and when I try to access a in my Spock method:
package com.example.dev;
def 'test a'() {
AClass aClassVar = new AClass()
aClassVar.a = new Integer(100);
...//other testing stuff
}
It works fine. Why this happens? Is Spock use reflection for accessing the private fields? Or my encapsulation in not written well?