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 red

Getting to red

- So, we're going to write our new test method, which we'll call, check a valid ISBN. I'll use the method stub that we've got sitting here. (typing) And before we do anything, the first thing we're going to do is to put in a liner code that says "this test needs to fail" and we do that by calling the fail method of JUnit that we saw earlier. (typing) And we can call that method without passing in any parameters like so. And let's just run that to make sure we get a red bar. Well we did, so that's good. So why did I do that? Well, it's an important first part of test driven development. Always start with a failing test. Remember the work flow is red green refactor, and now we've got the red part. In a moment of two, I'll show you why this is important. I actually can't do that, until we have at least one passing test, so I'm going to come back to this point in a couple of minutes. So we expect then, that if we call a method in our ISBN validator class, passing in the valid ISBN we got…

Contents