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.
Challenge 2
From the course: Practical Test-Driven Development for Java Programmers
Challenge 2
- [Instructor] Now before we go on, I want to just mention that in this instance, we've used an unchecked exception, this number format exception. We might discover later that there is a requirement to make this a checked exception. If that turns out to be the case, we will need to change this. But unless we know that that is the requirement, what we have is fine. And I'm pointing this out because I think this is quite a good example of the kind of thing that happens in test-driven development. We don't really know all the business requirements in detail. We're building with what we do know. But if we discover later that a checked exception is required, we can change this and we can use the test that we've built to check that nothing else is impacted by this change. Now at this stage, you could if you wanted, create more tests to check 11-digit numbers, or eight-digit numbers, but I think that is a waste of time. We know that our number format exception is going to be flown if the…
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
-
-
-
-
-
-
-