Is there any way to create a test case, where you could confirm, that the student has declared an attribute as private? For example, if I would have the following assignment:
- Create a class called "Dog".
- The class has one private attribute "name".
- Create getter and setter methods for the name attribute. The name of the getter method should be getName. The name of the setter method should be setName.
Test case could be like:
// Create an object
Dog dog = new Dog();
// Assign/set name
// Print name using getter
This way I can check that the getter and setter methods work, but how can I check that the name attribute is private and not public?