I am writing a simulation of Bananagrams. Currently, I have a GameMaster
class that maintains the common collection of pieces. The deal(Player)
method deals a certain number of pieces to that player.
I want to write unit tests for this. However, at this point, I have no getters, and thus no way to check the status of the objects.
Why not add getters? I don't want to add code to the public interface only for testing. Right now, there is no other reason to expose those functions.
What am I supposed to do here? Add the getters anyway, cluttering the public API (or hoping that they will be needed in the future)? Forgo unit testing? (Sounds like a bad idea.)
Or, does this indicate that my public interface is flawed?