Visibility of fields
pfichtner opened this issue · comments
Peter Fichtner commented
Is it intentional that the fields are not private? This makes "get it under test without changing the production code" relatively easy (which it wouldn't be otherwise)
Alarm alarm = new Alarm();
alarm.sensor = new MySensorStub();
Emily Bache commented
You make a good point. I was just looking at the other language versions and most have it private or protected. Package level privacy in Java is really quite permissive! I'd accept a pull request to make it protected, if you'd like to send one?
Peter Fichtner commented
Is there anything wrong with changing it to private
? Otherwise when leaving it protected
, replacing the field in a inheriting Alarm
class again would be to easy, wouldn't it?