Write the tests that you need to give you confidence that your program works properly.
There are people that would argue that if the class has no business logic there is no need to write tests for it. By that argument, then your simple getters and setters don't need to be tested. You only write tests for the parts of the code that have "business logic".
However the other side of the argument is that if you write the code, you should write a test for it. By that argument, you should write a test for them. The test will end up being really trivial. You instantiate the object, set a value with the setter and then assert that the value is then returned with the getter. You end up with a lot of simple tests and it can get tedious to write.
I am in the second camp and have found that if something is hard to test or becomes a pain for testing it is a sign that I have an issue with my design. In this case, you might have accessor methods for things that aren't needed. What likely happened is that you have all your properties in your data object and "need" to have a getter and setter for each of them. But do you really?
In your question, you mentioned that you have a getFullName
method. So do you really need methods for getFirstName
and getLastName
? Why would the data in the object change during the rendering of the page? Why not forgo setters and make the data record 'immutable' so that an update is done by sending a new object to the database for update/create?
I would bet that the reason that you are having this question is that you wrote this code and now are trying to go back and write tests for it. You have this data object and automatically created getters and setters for everything. Then wrote extra methods that you need as you were using it (like the getFullName
method). Rather I would recommend that you only create the accessors as you need them. Then you create the test at the time and you will find that the list of functions is substantially smaller. You might have a handful of methods that get the combinations of data that you require as well as a bulk method for getting all the data in a particular form (ie json).