TheSecretSquad / toyrobotsimulator

0 stars 0 forks source link

Refactor matching test helpers to LineMatcher. #6

Closed TheSecretSquad closed 9 years ago

TheSecretSquad commented 9 years ago

This was supposed to only include refactoring the matching helpers into a new class. I forgot I had started working on adding the RobotCommand and RobotCommands classes and the enterCommand/enterCommands method to the ToyRobotSimulation, so it includes that as well.

I decided that the simulation output is expected to be in lines, so the matcher is a "line matcher". You give it a string and it verifies that the string is a line in the content. I think it matches what we were testing a little better than what I started with. What do you think?

I had created some methods in ToyRobotSimulationTest that created RobotCommands from a variable length parameter list (String ... commands). It made it easier to create the commands for the test. I figured since there was a need to create RobotCommands like this, then maybe it should be a constructor. I made a constructor that does this, but I don't have a test that verifies the parameter list conversion I did works. I'm wondering what is the correct way to test this, or was this a good idea at all?