1 00:00:00,210 --> 00:00:05,490 We need to forbid the caller from misusing Method's or constructor's, the constructor doesn't receive 2 00:00:05,490 --> 00:00:07,689 any parameters, so nothing to check here. 3 00:00:08,250 --> 00:00:10,230 There is nothing a quality control in the center. 4 00:00:10,580 --> 00:00:13,040 All of them would already through a null pointer exception. 5 00:00:13,050 --> 00:00:15,570 So throwing our own exception would be redundant. 6 00:00:16,290 --> 00:00:18,590 Same can be said for removing checkout. 7 00:00:18,600 --> 00:00:23,910 We don't need to check for a legal argument exceptions, but these methods are vulnerable to being called 8 00:00:23,910 --> 00:00:24,770 at a bad time. 9 00:00:24,930 --> 00:00:30,960 For example, if a cart object doesn't have any items, then it's not in a legal state to call or remove 10 00:00:30,960 --> 00:00:31,790 or check out. 11 00:00:32,280 --> 00:00:36,880 You can't remove items if there aren't any and you can't check out an empty cart. 12 00:00:37,650 --> 00:00:40,500 So what we'll do is say if items that is empty. 13 00:00:45,530 --> 00:00:47,870 Throw a new illegal state exception. 14 00:00:50,270 --> 00:00:52,670 Cannot remove items from an empty cart. 15 00:01:04,290 --> 00:01:08,460 We can do the same thing for the check out action if items that is empty. 16 00:01:12,340 --> 00:01:14,530 There were new illegal state exception. 17 00:01:18,620 --> 00:01:20,540 Cannot check out an empty cart. 18 00:01:21,520 --> 00:01:26,620 As far as I know, that's all the quality control that we need to apply and both methods are going to 19 00:01:26,620 --> 00:01:28,680 forbid the caller from misusing them.