Originally posted by Tomasz Prus:
TDD question: How should i test domain classes when they have only getters and setters, what can i test? I heard that testing field accessors is nonsense.
Don't test classes that have nothing but getters and setter. Don't HAVE classes that have just getters and setters. Such classes are not classes at all -- they are data structures and their variables should be public.
Yes, I know there are "bean" standards. (Sigh). OK, so if you have to conform to a silly standard like that, go ahead and make your getters and setters. But don't test them.
Oh, and read the "Data" chapter in "Clean Code".