1 00:00:00,150 --> 00:00:04,330 And this solution, we're going to quality control the movie class, starting with the constructor, 2 00:00:04,350 --> 00:00:07,490 the caller should not be allowed to pass a name that is Neller Blank. 3 00:00:07,650 --> 00:00:09,390 So if the name is null. 4 00:00:12,180 --> 00:00:13,110 Or as blank. 5 00:00:16,400 --> 00:00:19,250 We're going to throw a new illegal argument exception. 6 00:00:24,100 --> 00:00:25,930 Name must contain a value. 7 00:00:32,420 --> 00:00:38,330 We also need to check if the format doesn't equal DVD or Blu ray, so our condition is going to check 8 00:00:38,330 --> 00:00:40,160 if format equals DVD. 9 00:00:42,480 --> 00:00:43,890 Or if it equals the Blu ray. 10 00:00:49,400 --> 00:00:53,660 Then we'll reverse it so that it checks if it doesn't equal DVD or Blu ray. 11 00:00:55,870 --> 00:00:57,700 In which case, we're going to throw a new. 12 00:01:00,380 --> 00:01:02,090 A legal argument, exception. 13 00:01:04,720 --> 00:01:08,230 Telling the caller format must be DVD or Blu ray. 14 00:01:14,670 --> 00:01:20,730 Also, ratings can only go from zero to 10, so we can't allow the color to pass in a negative rating 15 00:01:20,730 --> 00:01:22,000 or one that exceeds 10. 16 00:01:22,440 --> 00:01:24,870 So if rating is smaller than zero. 17 00:01:27,810 --> 00:01:29,550 Or if it's bigger than 10. 18 00:01:33,560 --> 00:01:37,580 We're going to throw a new illegal argument exception. 19 00:01:41,240 --> 00:01:42,380 Invalid rating. 20 00:01:50,560 --> 00:01:55,450 OK, now we need to quality control our methods, starting with name, the colour should not be allowed 21 00:01:55,450 --> 00:01:57,780 to update an object with a name that is blank. 22 00:01:57,790 --> 00:01:59,620 So if name is equal to null. 23 00:02:00,880 --> 00:02:01,930 Or if it's blank. 24 00:02:05,090 --> 00:02:05,900 Through a new. 25 00:02:09,050 --> 00:02:10,910 A legal argument, exception. 26 00:02:19,760 --> 00:02:25,610 Inside format will throw an exception of the format they passed isn't DVD or isn't Blu ray? 27 00:03:05,660 --> 00:03:09,440 And inside rating, we're going to check if the rating is less than zero. 28 00:03:12,950 --> 00:03:14,000 Or higher than 10. 29 00:03:17,400 --> 00:03:20,940 In which case, we need to throw another illegal argument, exception. 30 00:03:28,000 --> 00:03:33,160 And that's all for quality control, these methods and constructor are going to forbid the caller from 31 00:03:33,160 --> 00:03:33,990 misusing them.