I have a method I want to unit test, one that checks for a match between three cards. Because the cards are randomly generated, there's no way to set up three cards that I know will or won't match. I need to do this to unit test my isMatch()
method.
Is it acceptable to alter my Card class to add a method to explicitly set its value so I can unit test it? In general is it acceptable to make small additions to source code to make unit tests possible or is there a better -- or correct -- way to do it?