Cali Kim wrote:I understand creating a new value, but I'm having a problem deciding what values to use. The initial values (day, month, year) are all locked as private and will not transfer over into a test driver. Should I create new ones within the test driver? If so, how then will I be sure that it is calling the setter methods for testing?
That's all Greek to me. Like Dennis said, if you want to test a setter method, then here's what you do:
(1) Get the value of the variable which the setter affects. Store it in a local variable. (If that counts as "creating a new one", then yes, create a new one.) If you're concerned that the variable in question is private, then use some public method of getting that value.
(2) Call the setter method to assign a different value than what you just got. (Why would you not be sure that the test driver would be calling the setter method?)
(3) Get the value of the variable again. Check that it is the value that the setter method assigned in step 2 and not the value originally acquired in step 1.