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.

Why you always start with red

Why you always start with red

- [Instructor] Okay, so now we have one test and it's passing. That's a single cycle of test-driven development complete, but to get this functionality working properly, we'll have to write a few more tests and our code will then be able to evolve as we go forward. Don't worry if this seems like a slow and unwieldy process. It will speed up as we go further. So let's put in a second test, and this time, I think we'll test an ISPN number that is invalid. Now, because of the way that ISPN numbers work, I know that if you change a single digit, you will have an invalid ISPN number. So we can write a method to check this. I'm going to copy and paste the existing method to start. And we'll call the second method Check an Invalid ISPN. That looks okay. And let's change one of the digits in this ISPN number. I think we'll just change the last digit from a six to a seven. And of course, we expect that this is not a valid ISPN number so we expect the value of result to be false. So instead of…

Contents