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
From the course: Practical Test-Driven Development for Java Programmers
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Testing for exceptions5m 17s
-
(Locked)
Challenge 129s
-
(Locked)
Walkthrough 11m
-
(Locked)
Challenge 22m 25s
-
(Locked)
Walkthrough 2 and challenge 31m 25s
-
(Locked)
Walkthrough 31m 51s
-
(Locked)
Getting to more complex requirements4m 57s
-
(Locked)
Using TDD to safely fix bugs6m 52s
-
(Locked)
Challenge 4 and walkthrough 44m 5s
-
(Locked)
Finishing the business requirements7m 24s
-
-
-
-
-
-
-