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.

Adding more tests

Adding more tests

- [Instructor] Now, I think it would be nice to start to get into some of the proper functionality of ISBN numbers, so we need to come up with a test that will allow us to start to do that. And I think a good test might be, let's try a second ISBN number to use. This time we'll go to Amazon and we'll find another book. So this time I've got on screen, John Steinbeck's Of Mice and Men, and if we scroll down to where we can find the ISBN number, here it is. So here's a second valid ISBN number, and I'm just going to copy that. Now, we have a choice. Do we create a new test method for this second ISBN number, or do we add it to this first test method, check a valid ISBN? Well, an important aspect of test driven development is that each test must check one single identifiable piece of logic and only one. So normally you'd only expect to have one assert in a test method, but there are times when you can have more than one assert. But if you have more than one assert, it needs to fit one of…

Contents