Under what conditions should I test the get () and set () methods?

advertisements

I could not confirm whether to do these tests. It seems the set and get method is so simple,such as:

setA(String A) {
    this.A = A;
} 

getA(){
    return A;
}

Any ideas would be appreciated!

Thanks, Joseph


General rule: Not much point in writing tests for getters and setters. Only if they have some additional logic, ie. are not pure accessors, you should write the tests.