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.

Walkthrough 2 and challenge 3

Walkthrough 2 and challenge 3

- [Instructor] Let's start by writing this test then, and I think we'll call this one nonNumericISBNsAreNotAllowed. Okay, well I want to make sure I always have a red bar, so let's start by calling the fail method and make sure we get a red bar. Good, so the only one that's failed is our new test, and we have got our red bar. What we'd like to do then is something similar to these lines of code here, but this time we're passing in the string, helloworld, and we expect to get a NumberFormatException. So let's copy down the parameter, the expected parameter for our annotation, and then we can run the test and see what happens. Okay, well, it hasn't worked, we still got a failing test, and we expected to get the NumberFormatException, but we didn't. Okay, well, I hope you got something similar to that in terms of your test, and now we're going to fix this problem. And again, I'm going to suggest that you pause the video and give this a go. And what we're trying to do at this stage is…

Contents