The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joined: May 20, 2008
So, if i have for example POJO Address? What should i do with it? What behavior i can add to this class?
Joined: Jul 11, 2001
Originally posted by Tomasz Prus: So, if i have for example POJO Address? What should i do with it? What behavior i can add to this class?
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".
---<br />Uncle Bob.
subject: Clean Code A Handbook of Agile Software Craftsmanship - Test POJO