From the course: Practical Test-Driven Development for Java Programmers

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Getting to green

Getting to green

- [Instructor] Now let's go on to the second step, then, which is to write the code that makes this test pass. Now this is going to feel quite counterintuitive, if you're new to Test-Driven Development, but the idea here is that we're going to write the minimum possible code that we can to make this test pass. We're not interested in building the correct and full functionality at this point. Rather the minimum functionality to make this particular test pass. So how could we do that? Well, we could change our method to always return true. Here's our validate ISBN class, and in the check ISBN method, we could just, we'll always return true. And actually while I'm here I'm just going to remove this comment. Now I know that this is not the correct implementation of the check ISBN method. It's obviously not right, but this will make our tests pass, so it's the right thing to do. Don't worry that this feels wrong. We are going to be changing it to something better very soon. But this is…

Contents