This is the Java code as a starting point for my xUnit meta-kata.
Your goal is to refactor the nasty IF-heavy implementation of classes that score a game of Rock, Paper, Scissors.
There are tests, written inside a main() method of a Program class in an accompanying console app project.
Inside this old-fashioned test code (this is how we did it in the bad old days, I'm afraid - if we unit tested at all) there's some kind of unit testing framework trying to get out.
The meta- part of this kata is that while you're refactoring the implementation of Rock, Paper, Scissors, you must also refactor the test code to reveal the unit testing framework.
The rules are that you can only refactor to eliminate commonly-known "code smells" (see Fowler's Refactoring book/website) and/or when the code breaks one of the following design principles:
-
K.I.S.S.
-
D.R.Y.
-
Tell, Don't Ask
-
SOLID
Keep those test passing as you go, and have fun!
(estimated time 2-4 hours)
Jason Gorman http://www.codemanship.com