1
00:00:00,300 --> 00:00:05,430
And this solution or inequality, quality control, the contact class, if the color misuses, the methods

2
00:00:05,430 --> 00:00:09,270
are constructor's, we're going to throw an unchecked exception, which is going to force them to fix

3
00:00:09,270 --> 00:00:09,810
their code.

4
00:00:11,970 --> 00:00:16,250
We'll start with the constructor, the caller should not be allowed to pass on a name that is null or

5
00:00:16,260 --> 00:00:18,600
blank, so if the name is null.

6
00:00:21,590 --> 00:00:22,810
Our name is Blank.

7
00:00:26,250 --> 00:00:28,770
Then we'll throw a new illegal argument exception.

8
00:00:32,700 --> 00:00:34,890
Name cannot be null or a blank.

9
00:00:40,070 --> 00:00:41,750
We'll do the same thing for the phone number.

10
00:00:44,160 --> 00:00:45,780
If the phone number is null.

11
00:00:48,770 --> 00:00:49,520
Or blank.

12
00:00:53,990 --> 00:00:56,210
We'll throw in a legal argument exception.

13
00:01:08,150 --> 00:01:13,700
The phone number also can't be less than five characters, so we'll check if the phone number at length.

14
00:01:15,460 --> 00:01:16,600
Is less than five.

15
00:01:18,500 --> 00:01:19,790
We'll throw another exception.

16
00:01:37,870 --> 00:01:42,040
Ken, how should we throw an illegal argument, exception of birth date is another blank.

17
00:01:43,140 --> 00:01:48,540
You can if you want, I would say it's not necessary simply because the constructor already throws a

18
00:01:48,540 --> 00:01:51,210
check the exception, if the birthdate isn't passable.

19
00:01:54,890 --> 00:01:59,660
Now we need to quality control our methods, starting with set name, the colour should not be allowed

20
00:01:59,660 --> 00:02:02,190
to update an object with a name that is another blank.

21
00:02:03,080 --> 00:02:06,080
So if the name that was passed in is null or blank.

22
00:02:09,800 --> 00:02:11,030
You'll throw an exception.

23
00:02:20,860 --> 00:02:25,960
Same thing for the phone number, we'll throw an exception if they enter a number that is null or blank.

24
00:02:49,810 --> 00:02:54,990
We'll throw another one if the length of the phone number they pass down is less than five characters.

25
00:02:59,660 --> 00:03:02,030
In which case, we'll throw a new exception.

26
00:03:13,120 --> 00:03:15,700
Phone number cannot be less than five characters.

27
00:03:27,000 --> 00:03:32,250
And inside birthday, there's nothing to really do because if the color were to pass in an invalid birth

28
00:03:32,250 --> 00:03:34,530
date, the method would throw a pass exception.

29
00:03:34,890 --> 00:03:39,450
Now you can feel free to test the exceptions by passing in wrongful values, just like we did in the

30
00:03:39,450 --> 00:03:40,350
vending machine app.

31
00:03:40,710 --> 00:03:43,350
But I'm going to wrap it up right here and move on to part four.

