Book Image

Test-Driven Java Development

Book Image

Test-Driven Java Development

Overview of this book

Table of Contents (17 chapters)
Test-Driven Java Development
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
8
Refactoring Legacy Code – Making it Young Again
Index

Remote controlled ship requirements


We'll work on a variation of a well-known kata called Mars Rover, originally published in Dallas Hack Club (http://dallashackclub.com/rover).

Imagine that a naval ship is placed somewhere on Earth's seas. Since this is the 21st century, we can control that ship remotely.

Note

Our job will be to create a program that can move the ship around the seas.

Since this is a TDD book and the subject of this chapter is unit tests, we'll develop an application using a test-driven development approach with focus on unit tests. In the previous chapter, you learned the theory and had practical experience with the red-green-refactor procedure. We'll build on top of that and try to learn how to effectively employ unit testing. Specifically, we'll try to concentrate on a unit we're developing and learn how to isolate and ignore dependencies that a unit might use. Not only that, but we'll try to concentrate on one requirement at a time. For this reason, you were presented only...