Testing is more crucial as many people think today. You can find some useful tips from the book below:
Testing a setter, you will feel, is easy with the corresponding getter. You set the object and get the object to verify the result.
class Data {
private Int i;
public void setData(int i) {
this.i = i;
}
public void getData() {
return this.i;
}
}